@@ -57,6 +57,7 @@ export class PtyHostService extends Disposable implements IPtyService {
5757
5858 private readonly _shellEnv : Promise < typeof process . env > ;
5959 private readonly _resolveVariablesRequestStore : RequestStore < string [ ] , { workspaceId : string ; originalText : string [ ] } > ;
60+ private _wasQuitRequested = false ;
6061 private _restartCount = 0 ;
6162 private _isResponsive = true ;
6263 private _isDisposed = false ;
@@ -105,6 +106,7 @@ export class PtyHostService extends Disposable implements IPtyService {
105106
106107 this . _register ( toDisposable ( ( ) => this . _disposePtyHost ( ) ) ) ;
107108
109+
108110 this . _resolveVariablesRequestStore = this . _register ( new RequestStore ( undefined , this . _logService ) ) ;
109111 this . _resolveVariablesRequestStore . onCreateRequest ( this . _onPtyHostRequestResolveVariables . fire , this . _onPtyHostRequestResolveVariables ) ;
110112
@@ -115,6 +117,8 @@ export class PtyHostService extends Disposable implements IPtyService {
115117 } else {
116118 this . _ensurePtyHost ( ) ;
117119 }
120+
121+ this . _ptyHostStarter . onWillShutdown ?.( ( ) => this . _wasQuitRequested = true ) ;
118122 }
119123
120124 private get _ignoreProcessNames ( ) : string [ ] {
@@ -140,7 +144,6 @@ export class PtyHostService extends Disposable implements IPtyService {
140144 }
141145
142146 private _startPtyHost ( ) : [ IPtyHostConnection , IPtyService ] {
143- this . _logService . info ( 'startPtyHost' , new Error ( ) . stack ) ;
144147 const connection = this . _ptyHostStarter . start ( lastPtyId ) ;
145148 const client = connection . client ;
146149
@@ -154,7 +157,7 @@ export class PtyHostService extends Disposable implements IPtyService {
154157 // Handle exit
155158 this . _register ( connection . onDidProcessExit ( e => {
156159 this . _onPtyHostExit . fire ( e . code ) ;
157- if ( ! this . _isDisposed ) {
160+ if ( ! this . _wasQuitRequested && ! this . _isDisposed ) {
158161 if ( this . _restartCount <= Constants . MaxRestarts ) {
159162 this . _logService . error ( `ptyHost terminated unexpectedly with code ${ e . code } ` ) ;
160163 this . _restartCount ++ ;
0 commit comments