-
Notifications
You must be signed in to change notification settings - Fork 20
Open
Labels
Description
See sindresorhus/time-grunt#15.
Given the following code:
console.log("before");
process.on("exit", function() {
console.log("on exit");
});
process.exit();
console.log("after");
- In non-Windows Node.js, this properly logs
before
thenon exit
. - In Windows Node.js, this might log nothing, all three things, or some combination of them. Kinda random, depends on the shell, if output is piped or not, etc.
- With
require("exit")();
instead ofprocess.exit();
onlybefore
is logged.on exit
should be logged.
Take a look at this commit in the node-exit branch.
Granted, that code is currently failing... but if we can fix it, we might be able to allow @sindresorhus's plugin to continue working.
Possible solution: Set stream.write
to a NOP function after the exit
event has been called?