When I run myProgram from the command line, the output shows up in real time as it is being generated. When I spawn it from node like this, the stdout buffers and comes out one big chunk at a time.
const bat = require('child_process').spawn('myProgram', []);
bat.stdout.setEncoding('utf8');
bat.stdout.on('data', console.log);
How can I tell child_process not to buffer stdout? Or set the buffer size smaller?
via Joe Beuckman
No comments:
Post a Comment