Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Nov 19, 2021
1 parent 2930afa commit 2694799
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions lib/internal/streams/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -232,15 +232,19 @@ function pipelineImpl(streams, callback, opts) {
const end = reading || opts?.end !== false;

if (isNodeStream(stream)) {
finishCount++;
destroys.push(destroyer(stream, reading, end && writing, (err) => {
if (!err && !reading && isReadableFinished(stream, false)) {
stream.read(0);
destroyer(stream, true, writing, finish);
} else {
finish(err);
}
}));
if (end) {
finishCount++;
destroys.push(destroyer(stream, reading, writing, (err) => {
if (!err && !reading && isReadableFinished(stream, false)) {
stream.read(0);
destroyer(stream, true, writing, finish);
} else {
finish(err);
}
}));
} else {
stream.on('error', finish);
}
}

if (i === 0) {
Expand Down

0 comments on commit 2694799

Please sign in to comment.