Created
August 11, 2011 22:11
-
-
Save markdaws/1140933 to your computer and use it in GitHub Desktop.
Shutting down node.js and flushing stdout and stderr
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function flushAndShutdown(exitCode) { | |
if(process.stdout.flush()) { | |
process.exit(exitCode); | |
} | |
else { | |
process.stdout.on('drain', function() { | |
process.exit(exitCode); | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
as of today (node 0.10.31), streams no longer have
flush()
...