-
Notifications
You must be signed in to change notification settings - Fork 29.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
process.stdout/.stderr might loose data when calling process.exit() #3669
Comments
Please see #3170 -- the docs are incorrect but the situation is complex. I recommend you avoid using |
Please also see #2972 (comment) (Oh dear, this again.) |
Yes, this again. And shame on me that I thought node.js could be used to write a unix like tool without looking on the CLOSED issues. The "issue" thing here works as reliable as process.stdout/.stderr ... |
`process.exit` quits immediately, without allowing buffered output from say, a `console.log` to be printed. See these Node.js issues: nodejs/node#3669 nodejs/node#3170 nodejs/node#2972 (comment)
See #6456 for the latest. |
`process.exit` can truncate long output in certain node versions, see these tickets: nodejs/node#3669 nodejs/node#3170 nodejs/node#2972 (comment) fixes #161
this won't work reliable (but it should according to the docs):
Not all data is flushed when node.js ends and thus another process using its output will not get all written data.
It also doesn't help to use something like
That .end() throws and an finish is never emitted makes using process.stdout/.stderr something like lottery.
Also trying to workaround via
leads to another bunch of problems like EAGAIN errors.
I would suggest to implement .end() and finish events so that both process.stdout and .stderr behave like any other stream.
The text was updated successfully, but these errors were encountered: