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 duplexify premature destroy · nodejs/node@70244d0

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
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,6 @@ function _duplexify(pair) {
262262
cb(err);
263263
} else if (err) {
264264
d.destroy(err);
265-
} else if (!readable && !writable) {
266-
d.destroy();
267265
}
268266
}
269267

Collapse file

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

Copy file name to clipboardExpand all lines: test/parallel/test-stream-duplex-from.js
+22-1Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const common = require('../common');
44
const assert = require('assert');
5-
const { Duplex, Readable, Writable, pipeline } = require('stream');
5+
const { Duplex, Readable, Writable, pipeline, PassThrough } = require('stream');
66
const { Blob } = require('buffer');
77

88
{
@@ -278,3 +278,24 @@ const { Blob } = require('buffer');
278278

279279
duplex.write('test');
280280
}
281+
282+
{
283+
const through = new PassThrough({ objectMode: true });
284+
285+
let res = '';
286+
const d = Readable.from(['foo', 'bar'], { objectMode: true })
287+
.pipe(Duplex.from({
288+
writable: through,
289+
readable: through
290+
}));
291+
292+
d.on('data', (data) => {
293+
d.pause();
294+
setImmediate(() => {
295+
d.resume();
296+
});
297+
res += data;
298+
}).on('end', common.mustCall(() => {
299+
assert.strictEqual(res, 'foobar');
300+
})).on('close', common.mustCall());
301+
}

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.