Skip to content

Commit 1befccd

Browse files
committed
Crazy little hack by @vladikoff. Closes gh-2.
* Seems to work * WTF
1 parent b86352b commit 1befccd

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/exit.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,10 @@ module.exports = function exit(exitCode, streams) {
3232
});
3333
// If all streams were already drained, exit now.
3434
tryToExit();
35+
// In Windows, when run as a Node.js child process, a script utilizing
36+
// this library might just exit with a 0 exit code, regardless. This code,
37+
// despite the fact that it looks a bit crazy, appears to fix that.
38+
process.on('exit', function() {
39+
process.exit(exitCode);
40+
});
3541
};

0 commit comments

Comments
 (0)