0
0
mirror of https://github.com/nodejs/node.git synced 2024-12-01 16:10:02 +01:00
nodejs/lib
Ben Noordhuis 9ff7ed23cd lib: fix event race condition with -e
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>
2017-03-24 09:19:09 -07:00
..
internal lib: fix event race condition with -e 2017-03-24 09:19:09 -07:00
_debug_agent.js lib: remove unused msg parameter in debug_agent 2017-03-15 17:03:02 +01:00
_debugger.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
_http_agent.js http: use more efficient module.exports pattern 2017-03-20 16:01:31 -07:00
_http_client.js http: replace uses of self 2017-03-20 16:01:39 -07:00
_http_common.js http: avoid retaining unneeded memory 2017-03-22 10:26:02 -07:00
_http_incoming.js tools: ignore URLs in line length linting 2017-03-20 18:28:40 -07:00
_http_outgoing.js http: replace uses of self 2017-03-20 16:01:39 -07:00
_http_server.js http: avoid retaining unneeded memory 2017-03-22 10:26:02 -07:00
_linklist.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
_stream_duplex.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
_stream_passthrough.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
_stream_readable.js stream: avoid using forEach 2017-03-17 11:09:10 -07:00
_stream_transform.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
_stream_wrap.js stream: avoid using forEach 2017-03-17 11:09:10 -07:00
_stream_writable.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
_tls_common.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
_tls_legacy.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
_tls_wrap.js tls: make rejectUnauthorized default to true 2017-03-23 13:27:56 -07:00
.eslintrc.yaml tools: rename eslintrc to an undeprecated format 2017-01-18 09:48:52 +05:30
assert.js assert: enforce type check in deepStrictEqual 2017-03-12 17:07:13 +01:00
buffer.js buffer: remove unneeded eslint-disable comment 2017-03-20 19:13:59 -07:00
child_process.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
cluster.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
console.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
constants.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
crypto.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
dgram.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
dns.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
domain.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
events.js events, doc: check input in defaultMaxListeners 2017-03-22 13:59:45 -07:00
fs.js lib,src: make constants not inherit from Object 2017-03-22 15:02:43 -07:00
http.js http: use more efficient module.exports pattern 2017-03-20 16:01:31 -07:00
https.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
module.js module: avoid using forEach 2017-03-17 11:09:45 -07:00
net.js net: avoid using forEach 2017-03-17 11:09:30 -07:00
os.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
path.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
process.js src: remove excessive license boilerplate 2015-01-27 16:35:05 +11:00
punycode.js lib: remove let from for loops 2016-10-04 12:17:32 -04:00
querystring.js querystring: move isHexTable to internal 2017-03-21 17:27:11 -07:00
readline.js readline: rename deDupeHistory option 2017-03-22 08:56:24 -07:00
repl.js repl: avoid using forEach 2017-03-17 11:09:40 -07:00
stream.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
string_decoder.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
sys.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
timers.js timers: fix not to close reused timer handle 2017-03-22 10:47:52 -07:00
tls.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
tty.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
url.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
util.js lib: Use regex to compare error message 2017-03-22 09:54:56 -07:00
v8.js v8: add cachedDataVersionTag 2017-03-05 14:23:02 +01:00
vm.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00
zlib.js meta: restore original copyright header 2017-03-10 11:23:48 -08:00