Skip to content

Commit 7f09855

Browse files
committed
fixup
1 parent 77eeaa1 commit 7f09855

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

lib/internal/streams/pipeline.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -331,24 +331,24 @@ function pipe(src, dst) {
331331
src
332332
.on('end', end)
333333
.on('readable', pump)
334-
.on('error', cleanup);
334+
.on('error', done);
335335
dst
336336
.on('drain', pump)
337-
.on('error', cleanup);
337+
.on('error', done);
338338

339-
function cleanup() {
339+
function done() {
340340
src
341341
.off('end', end)
342342
.off('readable', pump)
343-
.off('error', cleanup);
343+
.off('error', done);
344344
dst
345345
.off('drain', pump)
346-
.off('error', cleanup);
346+
.off('error', done);
347347
}
348348

349349
function end() {
350350
dst.end();
351-
cleanup();
351+
done();
352352
}
353353

354354
const objectMode = (

test/parallel/test-stream-pipeline.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,10 +215,9 @@ const tsp = require('timers/promises');
215215
let sent = 0;
216216
const rs = new Readable({
217217
read() {
218-
if (sent++ > 10) {
219-
return;
220-
}
221-
rs.push('hello');
218+
setImmediate(() => {
219+
rs.push('hello');
220+
});
222221
},
223222
destroy: common.mustCall((err, cb) => {
224223
cb();

0 commit comments

Comments
 (0)