| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -334,7 +334,7 @@ function _duplexify(pair) { | |||
| 334 | 334 | eos(r, (err) => { | |
| 335 | 335 | readable = false; | |
| 336 | 336 | if (err) { | |
| 337 | - destroyer(r, err); | ||
| 337 | + destroyer(w, err); | ||
| 338 | 338 | } | |
| 339 | 339 | onfinished(err); | |
| 340 | 340 | }); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -401,3 +401,20 @@ function makeATestWritableStream(writeFunc) { | |||
| 401 | 401 | assert.strictEqual(d.writable, false); | |
| 402 | 402 | })); | |
| 403 | 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 | + assert.strictEqual(err, expectedErr); | ||
| 418 | + })); | ||
| 419 | + r.destroy(expectedErr); | ||
| 420 | + } | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments