File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -319,7 +319,7 @@ function destroyer(stream, err) {
319319 // TODO: Don't lose err?
320320 stream . close ( ) ;
321321 } else if ( err ) {
322- process . nextTick ( emitErrorCloseLegacy , stream ) ;
322+ process . nextTick ( emitErrorCloseLegacy , stream , err ) ;
323323 } else {
324324 process . nextTick ( emitCloseLegacy , stream ) ;
325325 }
Original file line number Diff line number Diff line change @@ -1526,3 +1526,33 @@ const tsp = require('timers/promises');
15261526 assert . strictEqual ( val , null ) ;
15271527 } ) ) ;
15281528}
1529+
1530+ {
1531+ // Mimics a legacy stream without the .destroy method
1532+ class LegacyWritable extends Stream {
1533+ write ( chunk , encoding , callback ) {
1534+ callback ( ) ;
1535+ }
1536+ }
1537+
1538+ const writable = new LegacyWritable ( ) ;
1539+ writable . on ( 'error' , common . mustCall ( ( err ) => {
1540+ assert . deepStrictEqual ( err , new Error ( 'stop' ) ) ;
1541+ } ) ) ;
1542+
1543+ pipeline (
1544+ Readable . from ( {
1545+ [ Symbol . asyncIterator ] ( ) {
1546+ return {
1547+ next ( ) {
1548+ return Promise . reject ( new Error ( 'stop' ) ) ;
1549+ }
1550+ } ;
1551+ }
1552+ } ) ,
1553+ writable ,
1554+ common . mustCall ( ( err ) => {
1555+ assert . deepStrictEqual ( err , new Error ( 'stop' ) ) ;
1556+ } )
1557+ ) ;
1558+ }
You can’t perform that action at this time.
0 commit comments