| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent ba45367 commit f8f6a21
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -777,8 +777,13 @@ Readable.prototype.pipe = function(dest, pipeOpts) { | |||
| 777 | 777 | debug('onerror', er); | |
| 778 | 778 | unpipe(); | |
| 779 | 779 | dest.removeListener('error', onerror); | |
| 780 | - if (EE.listenerCount(dest, 'error') === 0) | ||
| 781 | - errorOrDestroy(dest, er); | ||
| 780 | + if (EE.listenerCount(dest, 'error') === 0) { | ||
| 781 | + if (!dest.destroyed) { | ||
| 782 | + errorOrDestroy(dest, er); | ||
| 783 | + } else { | ||
| 784 | + dest.emit('error', er); | ||
| 785 | + } | ||
| 786 | + } | ||
| 782 | 787 | } | |
| 783 | 788 | ||
| 784 | 789 | // Make sure our error handler is attached before userland ones. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,21 @@ | |||
| 1 | + 'use strict'; | ||
| 2 | + const common = require('../common'); | ||
| 3 | + const assert = require('assert'); | ||
| 4 | + const { Readable, Writable } = require('stream'); | ||
| 5 | + | ||
| 6 | + process.on('uncaughtException', common.mustCall((err) => { | ||
| 7 | + assert.strictEqual(err.message, 'asd'); | ||
| 8 | + })); | ||
| 9 | + | ||
| 10 | + const r = new Readable({ | ||
| 11 | + read() { | ||
| 12 | + this.push('asd'); | ||
| 13 | + } | ||
| 14 | + }); | ||
| 15 | + const w = new Writable({ | ||
| 16 | + autoDestroy: true, | ||
| 17 | + write() {} | ||
| 18 | + }); | ||
| 19 | + | ||
| 20 | + r.pipe(w); | ||
| 21 | + w.destroy(new Error('asd')); | ||
| Back | FazBrowse Home | New Git URL |
0 commit comments