We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi, I have the following code for quickjs-emscripten that handle correctly the interruption:
const QuickJS = await getQuickJS(); const runtime = QuickJS.newRuntime(); runtime.setInterruptHandler(shouldInterruptAfterDeadline(Date.now() + 1000)); const vm = runtime.newContext(); const result = vm.unwrapResult(vm.evalCode("new Promise((out,err)=>{i = 0; while (1) { i++; } out(i);});")); const promise = result.consume(result=>vm.resolvePromise(result)); vm.runtime.executePendingJobs(); const resolvedPromise = await promise; if (resolvedPromise.error) { const errorJson = vm.dump(resolvedPromise.error); console.log(errorJson); resolvedPromise.error.dispose(); }
but when I try to recreate it with quickjs-emscripten-sync it do not catch and terminate Node:
const runtime = (await getQuickJS()).newRuntime(); runtime.setInterruptHandler(shouldInterruptAfterDeadline(Date.now() + 1000)); const vm = runtime.newContext(); const arena = new Arena(vm, { isMarshalable: true }); try{ const result = arena.evalCode("new Promise((out,err)=>{i = 0; while (1) { i++; } out(i);});"); arena.executePendingJobs(); console.log(await result); }catch(e) { console.error(e.message); }
error:
> node index npm error Lifecycle script `run` failed with error: npm error code 13
I did something wrong? Thanks
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi,
I have the following code for quickjs-emscripten that handle correctly the interruption:
but when I try to recreate it with quickjs-emscripten-sync it do not catch and terminate Node:
error:
I did something wrong?
Thanks
The text was updated successfully, but these errors were encountered: