Compare commits

...

2 commits

Author SHA1 Message Date
af4c40ce41 modified: qjs.c
Some checks are pending
ci / Linux (Ubuntu) (push) Waiting to run
ci / linux-asan (push) Waiting to run
ci / linux-msan (push) Waiting to run
ci / linux-ubsan (push) Waiting to run
ci / macOS (push) Waiting to run
ci / macos-asan (push) Waiting to run
ci / macos-ubsan (push) Waiting to run
ci / freebsd (push) Waiting to run
ci / qemu-alpine (arm32v6) (push) Waiting to run
ci / qemu-alpine (arm32v7) (push) Waiting to run
ci / qemu-alpine (arm64v8) (push) Waiting to run
ci / qemu-alpine (i386) (push) Waiting to run
ci / qemu-alpine (s390x) (push) Waiting to run
2024-10-25 11:34:47 -05:00
5f280254fa Make the js "break" even better. 2024-10-25 11:34:45 -05:00

5
qjs.c
View file

@ -528,11 +528,12 @@ int main(int argc, char **argv)
"globalThis.global = globalThis;\n" "globalThis.global = globalThis;\n"
"global.console.error = console.log\n" "global.console.error = console.log\n"
"global.console.warn = console.log\n" "global.console.warn = console.log\n"
"globalThis.break = () => { throw new Error('Break'); };\n"
"\n" "\n"
"if (typeof os !== 'undefined') {\n" "if (typeof os !== 'undefined') {\n"
" globalThis.sleep = os.sleep;\n" " globalThis.sleep = os.sleep;\n"
" async function setTimeout(func, ms) { await sleep(ms); return func(); }\n" " async function setTimeout2(func, ms) {globalThis.clearTimeout = false; await sleep(ms); if (!clearTimeout) { func(); } }\n"
" globalThis.setTimeout = setTimeout\n" " globalThis.setTimeout = setTimeout2\n"
"} else {\n" "} else {\n"
" console.error('os is not defined.');\n" " console.error('os is not defined.');\n"
"}\n" "}\n"