Nodejs always cann't capture child process's stdout data completely, unless child process fllush(stdout)

流过昼夜 提交于 2019-12-02 00:30:21

By default, stdout in general is buffered until a newline is written. However, if stdout is not a tty (which is the case here with child_process.spawn()), all output is buffered, regardless of newlines.

If you don't want to use fflush() manually, you can disable stdout buffering entirely by doing setbuf(stdout, NULL); once at the beginning of your C program.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!