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) {
319
319
// TODO: Don't lose err?
320
320
stream . close ( ) ;
321
321
} else if ( err ) {
322
- process . nextTick ( emitErrorCloseLegacy , stream ) ;
322
+ process . nextTick ( emitErrorCloseLegacy , stream , err ) ;
323
323
} else {
324
324
process . nextTick ( emitCloseLegacy , stream ) ;
325
325
}
Original file line number Diff line number Diff line change @@ -1526,3 +1526,33 @@ const tsp = require('timers/promises');
1526
1526
assert . strictEqual ( val , null ) ;
1527
1527
} ) ) ;
1528
1528
}
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