mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
Commit c5b07d4 ("lib: fix beforeExit not working with -e") runs the
to-be-evaluated code at a later time than before because it switches
from `process.nextTick()` to `setImmediate()`.
It affects `-e 'process.on("message", ...)'` because there is now a
larger time gap between startup and attaching the event listener,
increasing the chances of missing early messages. I'm reasonably
sure `process.nextTick()` was also susceptible to that, only less
pronounced.
Avoid the problem altogether by evaluating the code synchronously.
Harmonizes the logic with `Module.runMain()` from lib/module.js
which also calls `process._tickCallback()` afterwards.
PR-URL: https://github.com/nodejs/node/pull/11958
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
75 lines
2.0 KiB
Plaintext
75 lines
2.0 KiB
Plaintext
[eval]
|
|
[eval]:1
|
|
with(this){__filename}
|
|
^^^^
|
|
SyntaxError: Strict mode code may not include a with statement
|
|
at createScript (vm.js:*:*)
|
|
at Object.runInThisContext (vm.js:*:*)
|
|
at Object.<anonymous> ([eval]-wrapper:*:*)
|
|
at Module._compile (module.js:*:*)
|
|
at evalScript (bootstrap_node.js:*:*)
|
|
at run (bootstrap_node.js:*:*)
|
|
at run (bootstrap_node.js:*:*)
|
|
at startup (bootstrap_node.js:*:*)
|
|
at bootstrap_node.js:*:*
|
|
42
|
|
42
|
|
[eval]:1
|
|
throw new Error("hello")
|
|
^
|
|
|
|
Error: hello
|
|
at [eval]:1:7
|
|
at ContextifyScript.Script.runInThisContext (vm.js:*:*)
|
|
at Object.runInThisContext (vm.js:*:*)
|
|
at Object.<anonymous> ([eval]-wrapper:*:*)
|
|
at Module._compile (module.js:*:*)
|
|
at evalScript (bootstrap_node.js:*:*)
|
|
at run (bootstrap_node.js:*:*)
|
|
at run (bootstrap_node.js:*:*)
|
|
at startup (bootstrap_node.js:*:*)
|
|
at bootstrap_node.js:*:*
|
|
|
|
[eval]:1
|
|
throw new Error("hello")
|
|
^
|
|
|
|
Error: hello
|
|
at [eval]:1:7
|
|
at ContextifyScript.Script.runInThisContext (vm.js:*:*)
|
|
at Object.runInThisContext (vm.js:*:*)
|
|
at Object.<anonymous> ([eval]-wrapper:*:*)
|
|
at Module._compile (module.js:*:*)
|
|
at evalScript (bootstrap_node.js:*:*)
|
|
at run (bootstrap_node.js:*:*)
|
|
at run (bootstrap_node.js:*:*)
|
|
at startup (bootstrap_node.js:*:*)
|
|
at bootstrap_node.js:*:*
|
|
100
|
|
[eval]:1
|
|
var x = 100; y = x;
|
|
^
|
|
|
|
ReferenceError: y is not defined
|
|
at [eval]:1:16
|
|
at ContextifyScript.Script.runInThisContext (vm.js:*:*)
|
|
at Object.runInThisContext (vm.js:*:*)
|
|
at Object.<anonymous> ([eval]-wrapper:*:*)
|
|
at Module._compile (module.js:*:*)
|
|
at evalScript (bootstrap_node.js:*:*)
|
|
at run (bootstrap_node.js:*:*)
|
|
at run (bootstrap_node.js:*:*)
|
|
at startup (bootstrap_node.js:*:*)
|
|
at bootstrap_node.js:*:*
|
|
|
|
[eval]:1
|
|
var ______________________________________________; throw 10
|
|
^
|
|
10
|
|
|
|
[eval]:1
|
|
var ______________________________________________; throw 10
|
|
^
|
|
10
|
|
done
|