mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
stream: don't emit 'finish' after 'error'
Backport-PR-URL: https://github.com/nodejs/node/pull/32372 PR-URL: https://github.com/nodejs/node/pull/32275 Refs: https://github.com/nodejs/node/issues/28710 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Backport-PR-URL: https://github.com/nodejs/node/pull/32372
This commit is contained in:
1 parent
471a5d8b82
commit
23ba0889ce
2 files changed
+3
No files matched your search
@@ -647,6 +647,8 @@ function finishMaybe(stream, state) {
|
||||
if (need) {
|
||||
prefinish(stream, state);
|
||||
if (state.pendingcb === 0) {
|
||||
if (state.errorEmitted)
|
||||
return;
|
||||
state.finished = true;
|
||||
stream.emit('finish');
|
||||
|
||||
|
||||
@@ -132,6 +132,7 @@ const stream = require('stream');
|
||||
process.nextTick(cb);
|
||||
};
|
||||
w.on('error', common.mustCall());
|
||||
w.on('finish', common.mustNotCall());
|
||||
w.on('prefinish', () => {
|
||||
w.write("shouldn't write in prefinish listener");
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user