You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks a lot first for this amazing module, well done!
I have a strange behaviour where a script timeout breaks console.log. Actually, I am adding console to a sandbox in order to print traces from inside the script. Everything works fine, but when the script times out, it seems it breaks console.log.
I have created a simple program to reproduce the issue:
const { VM, VMScript } = require('vm2');
let vm = new VM({
timeout: 100,
sandbox: { console: console } // add console in order to use console.log from the script
});
while (true) {
try {
vm.run("while (true) console.log('log inside script');"); // after some timeouts, this line does not print anymore
} catch (err) {
console.warn(err.message);
}
console.log('log in main still working'); // after some timeouts, this line does not print anymore
console.error('error in main still working'); // this line print forever
}
Expected output:
log inside script
...
log inside script
Script execution timed out.
log in main still working
error in main still working
log inside script
...
log inside script
Script execution timed out.
log in main still working
error in main still working
...
Current output:
log inside script
...
log inside script
Script execution timed out.
error in main still working
Script execution timed out.
error in main still working
Script execution timed out.
error in main still working
Script execution timed out.
error in main still working
...
It shows that console.log in main is no more working after a couple of timeouts, while console.error is still working.
Am I doing something wrong, that breaks console.log?
The text was updated successfully, but these errors were encountered:
Hello,
Thanks a lot first for this amazing module, well done!
I have a strange behaviour where a script timeout breaks
console.log
. Actually, I am addingconsole
to a sandbox in order to print traces from inside the script. Everything works fine, but when the script times out, it seems it breaksconsole.log
.I have created a simple program to reproduce the issue:
Expected output:
Current output:
It shows that
console.log
in main is no more working after a couple of timeouts, whileconsole.error
is still working.Am I doing something wrong, that breaks
console.log
?The text was updated successfully, but these errors were encountered: