Closed
Description
I have this sample code :
var big_str = '';
for (var i = 0; i < 1024*1024; big_str += 'a', ++i);
big_str += 'END';
process.stdout.write(big_str);
Everything works as expected. The entire string is displayed to the output.
Then I add process.exit()
var big_str = '';
for (var i = 0; i < 1024*1024; big_str += 'a', ++i);
big_str += 'END';
process.stdout.write(big_str);
process.exit(0);
I noticed the "END" was missing. So I did
node app.js | wc -c
which returned 65536
.
I'm guessing this is used as buffer size somewhere. But still, why is process.exit() being called before write() has finished ?
iojs v2.3.1