Skip to content

Commit

Permalink
stream: callback should be called when there pendingcb is 0
Browse files Browse the repository at this point in the history
Fixes: #46170
  • Loading branch information
jakecastelli committed Jun 13, 2024
1 parent 5a19a9b commit 7deb05d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/internal/streams/end-of-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,9 @@ function eos(stream, options, callback) {
(!willEmitClose || isReadable(stream)) &&
(writableFinished || isWritable(stream) === false)
) {
process.nextTick(onclosed);
if (wState && wState.pendingcb === 0) {
process.nextTick(onclosed);
}
} else if (
!writable &&
(!willEmitClose || isWritable(stream)) &&
Expand Down

0 comments on commit 7deb05d

Please sign in to comment.