Skip to content

Commit

Permalink
stream: fix finished regression when working with legacy Stream
Browse files Browse the repository at this point in the history
  • Loading branch information
mcollina committed Nov 18, 2021
1 parent d6c3a10 commit ab9104f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/internal/streams/end-of-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ function eos(stream, options, callback) {
} else if (
!writable &&
(!willEmitClose || isWritable(stream)) &&
(readableFinished || !isReadable(stream))
(readableFinished || !isReadableNodeStream(stream))
) {
process.nextTick(onclose);
} else if ((rState && stream.req && stream.aborted)) {
Expand Down
9 changes: 8 additions & 1 deletion test/parallel/test-stream-finished.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ const {
Transform,
finished,
Duplex,
PassThrough
PassThrough,
Stream
} = require('stream');
const assert = require('assert');
const EE = require('events');
Expand Down Expand Up @@ -630,3 +631,9 @@ testClosed((opts) => new Writable({ write() {}, ...opts }));
}));
}));
}

{
// This case is needed to support the send module
const s = new Stream();
finished(s, common.mustNotCall());
}

0 comments on commit ab9104f

Please sign in to comment.