We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9a3a190 commit d0c9137Copy full SHA for d0c9137
2 files changed
lib/internal/streams/duplexify.js
@@ -334,7 +334,7 @@ function _duplexify(pair) {
334
eos(r, (err) => {
335
readable = false;
336
if (err) {
337
- destroyer(r, err);
+ destroyer(w, err);
338
}
339
onfinished(err);
340
});
test/parallel/test-stream-duplex-from.js
@@ -401,3 +401,20 @@ function makeATestWritableStream(writeFunc) {
401
assert.strictEqual(d.writable, false);
402
}));
403
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
418
419
+ r.destroy(expectedErr);
420
+}
0 commit comments