File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ interface IRendererConnection {
1616 initData : IInitData ;
1717}
1818
19+ var _isTerminating ;
1920// This calls exit directly in case the initialization is not finished and we need to exit
2021// Otherwise, if initialization completed we go to extensionHostMain.terminate()
2122let onTerminate = function ( ) {
@@ -32,6 +33,11 @@ function connectToRenderer(): TPromise<IRendererConnection> {
3233 let msg = marshalling . parse ( raw ) ;
3334
3435 const remoteCom = createIPC ( data => {
36+ // Needed to avoid EPIPE errors in process.send below when a channel is closed
37+ if ( _isTerminating === true ) {
38+ return ;
39+ }
40+
3541 process . send ( data ) ;
3642 stats . push ( data . length ) ;
3743 } ) ;
@@ -40,6 +46,7 @@ function connectToRenderer(): TPromise<IRendererConnection> {
4046 process . on ( 'message' , ( msg ) => {
4147 if ( msg . type === '__$terminate' ) {
4248 onTerminate ( ) ;
49+ _isTerminating = true ;
4350 return ;
4451 }
4552 remoteCom . handle ( msg ) ;
You can’t perform that action at this time.
0 commit comments