@@ -17,8 +17,6 @@ export {NonZeroExitError, normalizeSpawnCommand};
1717
1818const LINE_SEPARATOR_REGEX = / \r ? \n / ;
1919
20- const pipedStreams = new WeakSet < Readable > ( ) ;
21-
2220export interface Output {
2321 stderr : string ;
2422 stdout : string ;
@@ -336,7 +334,6 @@ export class ExecProcess implements Result {
336334
337335 this . _process = handle ;
338336 handle . once ( 'error' , this . _onError ) ;
339- handle . once ( 'exit' , this . _onExit ) ;
340337 handle . once ( 'close' , this . _onClose ) ;
341338
342339 if ( handle . stdin ) {
@@ -345,11 +342,7 @@ export class ExecProcess implements Result {
345342 if ( typeof stdin === 'string' ) {
346343 handle . stdin . end ( stdin ) ;
347344 } else {
348- const src = stdin ?. process ?. stdout ;
349- if ( src ) {
350- src . pipe ( handle . stdin ) ;
351- pipedStreams . add ( src ) ;
352- }
345+ stdin ?. process ?. stdout ?. pipe ( handle . stdin ) ;
353346 }
354347 }
355348 }
@@ -373,28 +366,6 @@ export class ExecProcess implements Result {
373366 this . _thrownError = err ;
374367 } ;
375368
376- protected _onExit = ( ) : void => {
377- // Node emits 'exit' before stdio streams have drained. Use setImmediate
378- // to let buffered data flow through before destroying the streams.
379- // If grandchild processes hold the pipe fds open, they would never fire
380- // 'close', so we destroy here to unblock readStream and combineStreams.
381- const out =
382- this . _streamOut && ! pipedStreams . has ( this . _streamOut )
383- ? this . _streamOut
384- : undefined ;
385- const err =
386- this . _streamErr && ! pipedStreams . has ( this . _streamErr )
387- ? this . _streamErr
388- : undefined ;
389- if ( ! out && ! err ) {
390- return ;
391- }
392- setImmediate ( ( ) => {
393- out ?. destroy ( ) ;
394- err ?. destroy ( ) ;
395- } ) ;
396- } ;
397-
398369 protected _onClose = ( ) : void => {
399370 if ( this . _resolveClose ) {
400371 this . _resolveClose ( ) ;
0 commit comments