@@ -43,6 +43,13 @@ export class PtyHostService extends Disposable implements IPtyService {
43
43
this . _ensurePtyHost ( ) ;
44
44
return this . __proxy ! ;
45
45
}
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
+ }
46
53
47
54
private _ensurePtyHost ( ) {
48
55
if ( ! this . __connection ) {
@@ -105,8 +112,6 @@ export class PtyHostService extends Disposable implements IPtyService {
105
112
// Start the pty host when a window requests a connection, if the starter has that capability.
106
113
if ( this . _ptyHostStarter . onRequestConnection ) {
107
114
Event . once ( this . _ptyHostStarter . onRequestConnection ) ( ( ) => this . _ensurePtyHost ( ) ) ;
108
- } else {
109
- this . _ensurePtyHost ( ) ;
110
115
}
111
116
112
117
this . _ptyHostStarter . onWillShutdown ?.( ( ) => this . _wasQuitRequested = true ) ;
@@ -228,13 +233,10 @@ export class PtyHostService extends Disposable implements IPtyService {
228
233
return this . _proxy . listProcesses ( ) ;
229
234
}
230
235
async getPerformanceMarks ( ) : Promise < performance . PerformanceMark [ ] > {
231
- if ( ! this . __proxy ) {
232
- return [ ] ;
233
- }
234
- return this . _proxy . getPerformanceMarks ( ) ;
236
+ return this . _optionalProxy ?. getPerformanceMarks ( ) ?? [ ] ;
235
237
}
236
- reduceConnectionGraceTime ( ) : Promise < void > {
237
- return this . _proxy . reduceConnectionGraceTime ( ) ;
238
+ async reduceConnectionGraceTime ( ) : Promise < void > {
239
+ return this . _optionalProxy ? .reduceConnectionGraceTime ( ) ;
238
240
}
239
241
start ( id : number ) : Promise < ITerminalLaunchError | { injectedArgs : string [ ] } | undefined > {
240
242
return this . _proxy . start ( id ) ;
0 commit comments