Skip to content
Closed
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
Prev Previous commit
Next Next commit
fixup
  • Loading branch information
ronag committed Jun 30, 2021
commit a4a04d00c099a48e3399d685d60b97532b87c8d0
6 changes: 4 additions & 2 deletions lib/internal/streams/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,21 +134,23 @@ async function pump(iterable, writable, finish) {
});

writable.on('drain', resume);
const cleanup = eos(writable, resume);
const cleanup = eos(writable, { readable: false }, resume);

try {
if (writable.writableNeedDrain) {
await wait();
}

for await (const chunk of iterable) {
if (writable.write(chunk) === false) {
if (!writable.write(chunk)) {
await wait();
}
}

writable.end();

await wait();

finish();
} catch (err) {
finish(error !== err ? aggregateTwoErrors(error, err) : err);
Expand Down