-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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 cannot be closed': process.stdout should behave like a standard stream #7606
Comments
That behavior is intentional and fixes more issues than it introduces. Most programs fail very badly if stdio could be closed and in fact they did. That's why we made stdio permanent in v0.6.0. I'll go ahead and close the issue. |
@bnoordhuis, is this functionality the same for stdin and stderr, how can I properly attach and deattach a Writable Stream to process.stdout out so I can get all my console output to a file |
In my opionion, node lacks |
solution I implemented check if this works or its a safe solution |
stdio (stderr & stdout) should for compatibility reasons not be closed/end():ed. However, this causes pipeline with a stdio destination to never finish. This commit fixes this issue at a performance cost. Refs: nodejs#7606 Fixes: nodejs#32363
stdio (stderr & stdout) should for compatibility reasons not be closed/end():ed. However, this causes pipeline with a stdio destination to never finish. This commit fixes this issue at a performance cost. Refs: #7606 Fixes: #32363 PR-URL: #32373 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
stdio (stderr & stdout) should for compatibility reasons not be closed/end():ed. However, this causes pipeline with a stdio destination to never finish. This commit fixes this issue at a performance cost. Refs: #7606 Fixes: #32363 PR-URL: #32373 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
stdio (stderr & stdout) should for compatibility reasons not be closed/end():ed. However, this causes pipeline with a stdio destination to never finish. This commit fixes this issue at a performance cost. Refs: #7606 Fixes: #32363 PR-URL: #32373 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
I think that the fact that stdout doesn't emit the "finish" event should be mentioned in the nodejs |
It does emit the finish event, try: const { stdout } = require('process');
process.stdout
.on('finish', () => console.error('finish'))
.end() |
Oh yes, it does sorry for that, I am just a beginner. |
sample code:
execution result: hangs forever
expect: process.stdout should behaves like a standard stream.
The text was updated successfully, but these errors were encountered: