Skip to content

Commit 21bd667

Browse files
committed
stream: fix finished typo
#31509 introduced a slight typo. Fortunately this typo does not have big impact due to `isWritableFinished()`. Fixes: #31509 (comment) PR-URL: #31881 Fixes: #31509 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
1 parent 2f23918 commit 21bd667

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function eos(stream, opts, callback) {
6262
};
6363

6464
let writableFinished = stream.writableFinished ||
65-
(rState && rState.finished);
65+
(wState && wState.finished);
6666
const onfinish = () => {
6767
writable = false;
6868
writableFinished = true;

test/parallel/test-stream-finished.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,6 @@ testClosed((opts) => new Writable({ write() {}, ...opts }));
312312
}));
313313
}
314314

315-
316315
{
317316
const r = new Readable({
318317
autoDestroy: false
@@ -332,3 +331,14 @@ testClosed((opts) => new Writable({ write() {}, ...opts }));
332331
finished(rs, common.mustCall());
333332
}));
334333
}
334+
335+
{
336+
const d = new EE();
337+
d._writableState = {};
338+
d._writableState.finished = true;
339+
finished(d, { readable: false, writable: true }, common.mustCall((err) => {
340+
assert.strictEqual(err, undefined);
341+
}));
342+
d._writableState.errored = true;
343+
d.emit('close');
344+
}

0 commit comments

Comments
 (0)