Nodejs always cann't capture child process's stdout data completely, unless child process fllush(stdout)
问题 I use nodejs to captured its child process's stdout data, but always captured the former part of child process's stdout data. When I add fllush(stdout) ,It works OK. But I don't know why, and don't want to add flush(stdout). Here is my code: var tail_child = spawn(exefile, [arg1, arg2, arg3]); tail_child.stdin.write('msg\n'); tail_child.stdout.on('data', function(data) { console.log(data); }); child_process.c printf("data\n"); Need your help! Thank you very much! 回答1: By default, stdout in