Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
stream: fix finished typo
#31509 introduced a slight typo.
Fortunately this typo does not have big impact due to
`isWritableFinished()`.

Fixes: #31509 (comment)
  • Loading branch information
ronag committed Feb 20, 2020
commit 242ccc2e52bd6d4871972554d07b8a1820f97dc4
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 }));
}));
}


Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated whitespace change?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, there was an extra whitespace that shouldn't be there...

{
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');
}