Skip to content

Commit ab9104f

Browse files
committed
stream: fix finished regression when working with legacy Stream
1 parent d6c3a10 commit ab9104f

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ function eos(stream, options, callback) {
171171
} else if (
172172
!writable &&
173173
(!willEmitClose || isWritable(stream)) &&
174-
(readableFinished || !isReadable(stream))
174+
(readableFinished || !isReadableNodeStream(stream))
175175
) {
176176
process.nextTick(onclose);
177177
} else if ((rState && stream.req && stream.aborted)) {

test/parallel/test-stream-finished.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ const {
77
Transform,
88
finished,
99
Duplex,
10-
PassThrough
10+
PassThrough,
11+
Stream
1112
} = require('stream');
1213
const assert = require('assert');
1314
const EE = require('events');
@@ -630,3 +631,9 @@ testClosed((opts) => new Writable({ write() {}, ...opts }));
630631
}));
631632
}));
632633
}
634+
635+
{
636+
// This case is needed to support the send module
637+
const s = new Stream();
638+
finished(s, common.mustNotCall());
639+
}

0 commit comments

Comments
 (0)