Skip to content

Commit 77f8d39

Browse files
committed
fix other.test_returncode by emitting exit code in node if we waited too long for it to drain stdout
1 parent 9aa8ab3 commit 77f8d39

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/postamble.js

+5
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,11 @@ function exit(status) {
183183
process['exit'](status);
184184
});
185185
console.log(' '); // Make sure to print something to force the drain event to occur, in case the stdout buffer was empty.
186+
// Work around another node bug where sometimes 'drain' is never fired - make another effort
187+
// to emit the exit status, after a significant delay (if node hasn't fired drain by then, give up)
188+
setTimeout(function() {
189+
process['exit'](status);
190+
}, 500);
186191
} else if (ENVIRONMENT_IS_SHELL && typeof quit === 'function') {
187192
quit(status);
188193
} else {

0 commit comments

Comments
 (0)