mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 07:27:22 +01:00
c5b07d4ec6
Commit 93a44d5
("src: fix deferred events not working with -e") defers
evaluation of the script to the next tick.
A side effect of that change is that 'beforeExit' listeners run before
the actual script. 'beforeExit' is emitted when the event loop is
empty but process.nextTick() does not ref the event loop.
Fix that by using setImmediate(). Because it is implemented in terms
of a uv_check_t handle, it interacts with the event loop properly.
Fixes: https://github.com/nodejs/node/issues/8534
PR-URL: https://github.com/nodejs/node/pull/8821
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
70 lines
2.1 KiB
Plaintext
70 lines
2.1 KiB
Plaintext
[stdin]
|
|
|
|
[stdin]:1
|
|
with(this){__filename}
|
|
^^^^
|
|
SyntaxError: Strict mode code may not include a with statement
|
|
at Object.exports.runInThisContext (vm.js:*)
|
|
at Object.<anonymous> ([stdin]-wrapper:*:*)
|
|
at Module._compile (module.js:*:*)
|
|
at Immediate.<anonymous> (bootstrap_node.js:*:*)
|
|
at runCallback (timers.js:*:*)
|
|
at tryOnImmediate (timers.js:*:*)
|
|
at processImmediate [as _immediateCallback] (timers.js:*:*)
|
|
42
|
|
42
|
|
|
|
[stdin]:1
|
|
throw new Error("hello")
|
|
^
|
|
Error: hello
|
|
at [stdin]:1:*
|
|
at ContextifyScript.Script.runInThisContext (vm.js:*)
|
|
at Object.exports.runInThisContext (vm.js:*)
|
|
at Object.<anonymous> ([stdin]-wrapper:*:*)
|
|
at Module._compile (module.js:*:*)
|
|
at Immediate.<anonymous> (bootstrap_node.js:*:*)
|
|
at runCallback (timers.js:*:*)
|
|
at tryOnImmediate (timers.js:*:*)
|
|
at processImmediate [as _immediateCallback] (timers.js:*:*)
|
|
|
|
[stdin]:1
|
|
throw new Error("hello")
|
|
^
|
|
Error: hello
|
|
at [stdin]:1:*
|
|
at ContextifyScript.Script.runInThisContext (vm.js:*)
|
|
at Object.exports.runInThisContext (vm.js:*)
|
|
at Object.<anonymous> ([stdin]-wrapper:*:*)
|
|
at Module._compile (module.js:*:*)
|
|
at Immediate.<anonymous> (bootstrap_node.js:*:*)
|
|
at runCallback (timers.js:*:*)
|
|
at tryOnImmediate (timers.js:*:*)
|
|
at processImmediate [as _immediateCallback] (timers.js:*:*)
|
|
100
|
|
|
|
[stdin]:1
|
|
var x = 100; y = x;
|
|
^
|
|
ReferenceError: y is not defined
|
|
at [stdin]:1:16
|
|
at ContextifyScript.Script.runInThisContext (vm.js:*)
|
|
at Object.exports.runInThisContext (vm.js:*)
|
|
at Object.<anonymous> ([stdin]-wrapper:*:*)
|
|
at Module._compile (module.js:*:*)
|
|
at Immediate.<anonymous> (bootstrap_node.js:*:*)
|
|
at runCallback (timers.js:*:*)
|
|
at tryOnImmediate (timers.js:*:*)
|
|
at processImmediate [as _immediateCallback] (timers.js:*:*)
|
|
|
|
[stdin]:1
|
|
var ______________________________________________; throw 10
|
|
^
|
|
10
|
|
|
|
[stdin]:1
|
|
var ______________________________________________; throw 10
|
|
^
|
|
10
|
|
done
|