Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
3 changes: 1 addition & 2 deletions lib/internal/streams/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,9 @@ async function pumpToNode(iterable, writable, finish, { end }) {

if (end) {
writable.end();
await wait();
}

await wait();

finish();
} catch (err) {
finish(error !== err ? aggregateTwoErrors(error, err) : err);
Expand Down
17 changes: 17 additions & 0 deletions test/parallel/test-stream-pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -1616,3 +1616,20 @@ const tsp = require('timers/promises');
dup.push(null);
dup.read();
}

{
let res = '';
const writable = new Writable({
write(chunk, enc, cb) {
res += chunk;
cb();
}
});
pipelinep(async function*() {
yield 'hello';
yield 'world';
}, writable, { end: false }).then(common.mustCall(() => {
assert.strictEqual(res, 'helloworld');
assert.strictEqual(writable.closed, false);
}));
}