Skip to content

Commit

Permalink
fix other.test_returncode by emitting exit code in node if we waited …
Browse files Browse the repository at this point in the history
…too long for it to drain stdout
  • Loading branch information
kripken committed Jul 28, 2014
1 parent 9aa8ab3 commit 77f8d39
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/postamble.js
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,11 @@ function exit(status) {
process['exit'](status);
});
console.log(' '); // Make sure to print something to force the drain event to occur, in case the stdout buffer was empty.
// Work around another node bug where sometimes 'drain' is never fired - make another effort
// to emit the exit status, after a significant delay (if node hasn't fired drain by then, give up)
setTimeout(function() {
process['exit'](status);
}, 500);
} else if (ENVIRONMENT_IS_SHELL && typeof quit === 'function') {
quit(status);
} else {
Expand Down

0 comments on commit 77f8d39

Please sign in to comment.