GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — stream: fix premature pipeline end · nodejs/node@84d0eb7

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib/internal/streams
    • pipeline.js
  • test/parallel
    • test-stream-pipeline.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/internal/streams/pipeline.js‎

Copy file name to clipboardExpand all lines: lib/internal/streams/pipeline.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ const {
3838
isTransformStream,
3939
isWebStream,
4040
isReadableStream,
41-
isReadableEnded,
41+
isReadableFinished,
4242
} = require('internal/streams/utils');
4343
const { AbortController } = require('internal/abort_controller');
4444

@@ -424,7 +424,7 @@ function pipe(src, dst, finish, { end }) {
424424
dst.end();
425425
}
426426

427-
if (isReadableEnded(src)) { // End the destination if the source has already ended.
427+
if (isReadableFinished(src)) { // End the destination if the source has already ended.
428428
process.nextTick(endFn);
429429
} else {
430430
src.once('end', endFn);
Collapse file

‎test/parallel/test-stream-pipeline.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream-pipeline.js
+28Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1634,3 +1634,31 @@ const tsp = require('timers/promises');
16341634
assert.strictEqual(writable.closed, false);
16351635
}));
16361636
}
1637+
1638+
{
1639+
const r = new Readable();
1640+
for (let i = 0; i < 4000; i++) {
1641+
r.push('asdfdagljanfgkaljdfn');
1642+
}
1643+
r.push(null);
1644+
1645+
let ended = false;
1646+
r.on('end', () => {
1647+
ended = true;
1648+
});
1649+
1650+
const w = new Writable({
1651+
write(chunk, enc, cb) {
1652+
cb(null);
1653+
},
1654+
final: common.mustCall((cb) => {
1655+
assert.strictEqual(ended, true);
1656+
cb(null);
1657+
})
1658+
});
1659+
1660+
pipeline(r, w, common.mustCall((err) => {
1661+
assert.strictEqual(err, undefined);
1662+
}));
1663+
1664+
}

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.