Skip to content

Instantly share code, notes, and snippets.

@mafintosh
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mafintosh/11007750 to your computer and use it in GitHub Desktop.
Save mafintosh/11007750 to your computer and use it in GitHub Desktop.
stdout blocks but says its flushing - see testcase.sh
// do nothing
setInterval(function() {
// just to keep the program going
}, 1000)
var data = new Buffer(10*1024);
data.fill(97);
for (var i = 0; i < 10; i++) {
console.error('flushed?', process.stdout.write(data) !== false);
}
console.error('end of program');
# this will not print end-of-program
node producer.js | node consumer.js
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment