Files
node/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
..
2017-03-20 16:01:39 -07:00
2017-03-20 16:01:39 -07:00
2017-03-17 11:09:10 -07:00
2017-03-10 11:23:48 -08:00
2017-03-17 11:09:45 -07:00
2017-03-17 11:09:30 -07:00
2017-03-10 11:23:48 -08:00
2016-10-04 12:17:32 -04:00
2017-03-17 11:09:40 -07:00
2017-03-10 11:23:48 -08:00
2017-03-10 11:23:48 -08:00
2017-03-10 11:23:48 -08:00
2017-03-10 11:23:48 -08:00
2017-03-05 14:23:02 +01:00
2017-03-10 11:23:48 -08:00