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: ensuring cross-destruction in _duplexify to prevent leaks · nodejs/node@b992962

File tree

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

‎lib/internal/streams/duplexify.js‎

Copy file name to clipboardExpand all lines: lib/internal/streams/duplexify.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ function _duplexify(pair) {
334334
eos(r, (err) => {
335335
readable = false;
336336
if (err) {
337-
destroyer(r, err);
337+
destroyer(w, err);
338338
}
339339
onfinished(err);
340340
});
Collapse file

‎test/parallel/test-stream-duplex-from.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-stream-duplex-from.js
+17Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -401,3 +401,20 @@ function makeATestWritableStream(writeFunc) {
401401
assert.strictEqual(d.writable, false);
402402
}));
403403
}
404+
405+
// When the readable side errors, the error must propagate to the writable side.
406+
{
407+
const expectedErr = new Error('readable error');
408+
const r = new Readable({ read() {} });
409+
const w = new Writable({
410+
write(chunk, encoding, callback) { callback(); },
411+
});
412+
const d = Duplex.from({ readable: r, writable: w });
413+
d.on('error', common.mustCall((err) => {
414+
assert.strictEqual(err, expectedErr);
415+
}));
416+
w.on('error', common.mustCall((err) => {
417+
assert.strictEqual(err, expectedErr);
418+
}));
419+
r.destroy(expectedErr);
420+
}

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.