File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed
src/client/common/process Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change
1
+ Add event handlers to stream error events to prevent process from exiting due to errors in process stdout & stderr streams.
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ import {
17
17
SpawnOptions ,
18
18
StdErrError ,
19
19
} from './types' ;
20
+ import { noop } from '../utils/misc' ;
20
21
21
22
export function getDefaultOptions < T extends ShellOptions | SpawnOptions > (
22
23
options : T ,
@@ -98,6 +99,10 @@ export function plainExec(
98
99
const spawnOptions = getDefaultOptions ( options , defaultEnv ) ;
99
100
const encoding = spawnOptions . encoding ? spawnOptions . encoding : 'utf8' ;
100
101
const proc = spawn ( file , args , spawnOptions ) ;
102
+ // Listen to these errors (unhandled errors in streams tears down the process).
103
+ // Errors will be bubbled up to the `error` event in `proc`, hence no need to log.
104
+ proc . stdout ?. on ( 'error' , noop ) ;
105
+ proc . stderr ?. on ( 'error' , noop ) ;
101
106
const deferred = createDeferred < ExecutionResult < string > > ( ) ;
102
107
const disposable : IDisposable = {
103
108
dispose : ( ) => {
You can’t perform that action at this time.
0 commit comments