File tree Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Expand file tree Collapse file tree 3 files changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -358,8 +358,7 @@ export class ProcessPromise extends Promise<ProcessOutput> {
358
358
from . pipe ( dest . stdin )
359
359
return dest
360
360
}
361
-
362
- from . pipe ( dest )
361
+ from . once ( 'end' , ( ) => dest . emit ( 'end-piped-from' ) ) . pipe ( dest )
363
362
return promisifyStream ( dest )
364
363
}
365
364
Original file line number Diff line number Diff line change @@ -462,6 +462,7 @@ export const promisifyStream = <S extends Writable>(
462
462
target
463
463
. once ( 'error' , ( e ) => _rej ( rej ( e ) ) )
464
464
. once ( 'finish' , ( ) => _res ( res ( target ) ) )
465
+ . once ( 'end-piped-from' , ( ) => _res ( res ( target ) ) )
465
466
)
466
467
}
467
468
const value = Reflect . get ( target , key )
Original file line number Diff line number Diff line change @@ -427,6 +427,11 @@ describe('core', () => {
427
427
assert . equal ( ( await fs . readFile ( file ) ) . toString ( ) , 'HELLO\n' )
428
428
await fs . rm ( file )
429
429
} )
430
+
431
+ test ( '$ > stdout' , async ( ) => {
432
+ const p = $ `echo 1` . pipe ( process . stdout )
433
+ assert . equal ( await p , process . stdout )
434
+ } )
430
435
} )
431
436
432
437
it ( 'supports delayed piping' , async ( ) => {
You can’t perform that action at this time.
0 commit comments