Skip to content

Commit

Permalink
stream: fix finished typo
Browse files Browse the repository at this point in the history
#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 <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
  • Loading branch information
ronag committed Feb 22, 2020
1 parent 2f23918 commit 21bd667
Show file tree
Hide file tree
Showing 2 changed files with 12 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 @@ -62,7 +62,7 @@ function eos(stream, opts, callback) {
};

let writableFinished = stream.writableFinished ||
(rState && rState.finished);
(wState && wState.finished);
const onfinish = () => {
writable = false;
writableFinished = true;
Expand Down
12 changes: 11 additions & 1 deletion test/parallel/test-stream-finished.js
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,6 @@ testClosed((opts) => new Writable({ write() {}, ...opts }));
}));
}


{
const r = new Readable({
autoDestroy: false
Expand All @@ -332,3 +331,14 @@ testClosed((opts) => new Writable({ write() {}, ...opts }));
finished(rs, common.mustCall());
}));
}

{
const d = new EE();
d._writableState = {};
d._writableState.finished = true;
finished(d, { readable: false, writable: true }, common.mustCall((err) => {
assert.strictEqual(err, undefined);
}));
d._writableState.errored = true;
d.emit('close');
}

0 comments on commit 21bd667

Please sign in to comment.