@@ -43,6 +43,13 @@ export class PtyHostService extends Disposable implements IPtyService {
4343 this . _ensurePtyHost ( ) ;
4444 return this . __proxy ! ;
4545 }
46+ /**
47+ * Get the proxy if it exists, otherwise undefined. This is used when calls are not needed to be
48+ * passed through to the pty host if it has not yet been spawned.
49+ */
50+ private get _optionalProxy ( ) : IPtyService | undefined {
51+ return this . __proxy ;
52+ }
4653
4754 private _ensurePtyHost ( ) {
4855 if ( ! this . __connection ) {
@@ -105,8 +112,6 @@ export class PtyHostService extends Disposable implements IPtyService {
105112 // Start the pty host when a window requests a connection, if the starter has that capability.
106113 if ( this . _ptyHostStarter . onRequestConnection ) {
107114 Event . once ( this . _ptyHostStarter . onRequestConnection ) ( ( ) => this . _ensurePtyHost ( ) ) ;
108- } else {
109- this . _ensurePtyHost ( ) ;
110115 }
111116
112117 this . _ptyHostStarter . onWillShutdown ?.( ( ) => this . _wasQuitRequested = true ) ;
@@ -228,13 +233,10 @@ export class PtyHostService extends Disposable implements IPtyService {
228233 return this . _proxy . listProcesses ( ) ;
229234 }
230235 async getPerformanceMarks ( ) : Promise < performance . PerformanceMark [ ] > {
231- if ( ! this . __proxy ) {
232- return [ ] ;
233- }
234- return this . _proxy . getPerformanceMarks ( ) ;
236+ return this . _optionalProxy ?. getPerformanceMarks ( ) ?? [ ] ;
235237 }
236- reduceConnectionGraceTime ( ) : Promise < void > {
237- return this . _proxy . reduceConnectionGraceTime ( ) ;
238+ async reduceConnectionGraceTime ( ) : Promise < void > {
239+ return this . _optionalProxy ? .reduceConnectionGraceTime ( ) ;
238240 }
239241 start ( id : number ) : Promise < ITerminalLaunchError | { injectedArgs : string [ ] } | undefined > {
240242 return this . _proxy . start ( id ) ;
0 commit comments