Skip to content

Commit

Permalink
stream: removed check to emit close and emitting error
Browse files Browse the repository at this point in the history
On the domain of process.stdout we removed check
and now we emit error on destroyer

Fix: #39447
  • Loading branch information
ktfth committed Aug 4, 2021
1 parent 0122a9b commit dff2abb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
8 changes: 3 additions & 5 deletions lib/internal/bootstrap/switches/is_main_thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,9 @@ function dummyDestroy(err, cb) {
// are not going to do it twice.
// The 'close' event is needed so that finished and
// pipeline work correctly.
if (!this._writableState.emitClose) {
process.nextTick(() => {
this.emit('close');
});
}
process.nextTick(() => {
this.emit('close');
});
}

let stdin;
Expand Down
3 changes: 1 addition & 2 deletions lib/internal/streams/destroy.js
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,8 @@ function destroyer(stream, err) {
stream.abort();
} else if (isRequest(stream.req)) {
stream.req.abort();
} else if (stream === process.stdout && typeof stream.end === 'function') {
} else if (stream === process.stdout && err) {
stream.emit('error', err);
stream.end();
} else if (typeof stream.destroy === 'function') {
stream.destroy(err);
} else if (typeof stream.close === 'function') {
Expand Down

0 comments on commit dff2abb

Please sign in to comment.