Skip to content

Commit 7deb05d

Browse files
committed
stream: callback should be called when there pendingcb is 0
Fixes: #46170
1 parent 5a19a9b commit 7deb05d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/internal/streams/end-of-stream.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ function eos(stream, options, callback) {
215215
(!willEmitClose || isReadable(stream)) &&
216216
(writableFinished || isWritable(stream) === false)
217217
) {
218-
process.nextTick(onclosed);
218+
if (wState && wState.pendingcb === 0) {
219+
process.nextTick(onclosed);
220+
}
219221
} else if (
220222
!writable &&
221223
(!willEmitClose || isWritable(stream)) &&

0 commit comments

Comments
 (0)