Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ronag committed Nov 22, 2021
1 parent 77eeaa1 commit 7f09855
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
12 changes: 6 additions & 6 deletions lib/internal/streams/pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,24 +331,24 @@ function pipe(src, dst) {
src
.on('end', end)
.on('readable', pump)
.on('error', cleanup);
.on('error', done);
dst
.on('drain', pump)
.on('error', cleanup);
.on('error', done);

function cleanup() {
function done() {
src
.off('end', end)
.off('readable', pump)
.off('error', cleanup);
.off('error', done);
dst
.off('drain', pump)
.off('error', cleanup);
.off('error', done);
}

function end() {
dst.end();
cleanup();
done();
}

const objectMode = (
Expand Down
7 changes: 3 additions & 4 deletions test/parallel/test-stream-pipeline.js
Original file line number Diff line number Diff line change
Expand Up @@ -215,10 +215,9 @@ const tsp = require('timers/promises');
let sent = 0;
const rs = new Readable({
read() {
if (sent++ > 10) {
return;
}
rs.push('hello');
setImmediate(() => {
rs.push('hello');
});
},
destroy: common.mustCall((err, cb) => {
cb();
Expand Down

0 comments on commit 7f09855

Please sign in to comment.