@@ -364,8 +364,14 @@ export class CodeApplication extends Disposable {
364
364
365
365
// Spawn shared process after the first window has opened and 3s have passed
366
366
const sharedProcess = this . instantiationService . createInstance ( SharedProcess , machineId , this . userEnv ) ;
367
- const sharedProcessClient = sharedProcess . whenIpcReady ( ) . then ( ( ) => connect ( this . environmentService . sharedIPCHandle , 'main' ) ) ;
368
- const sharedProcessReady = sharedProcess . whenReady ( ) . then ( ( ) => sharedProcessClient ) ;
367
+ const sharedProcessClient = sharedProcess . whenIpcReady ( ) . then ( ( ) => {
368
+ this . logService . trace ( 'Shared process: IPC ready' ) ;
369
+ return connect ( this . environmentService . sharedIPCHandle , 'main' ) ;
370
+ } ) ;
371
+ const sharedProcessReady = sharedProcess . whenReady ( ) . then ( ( ) => {
372
+ this . logService . trace ( 'Shared process: init ready' ) ;
373
+ return sharedProcessClient ;
374
+ } ) ;
369
375
this . lifecycleMainService . when ( LifecycleMainPhase . AfterWindowOpen ) . then ( ( ) => {
370
376
this . _register ( new RunOnceScheduler ( async ( ) => {
371
377
const userEnv = await getShellEnvironment ( this . logService , this . environmentService ) ;
@@ -389,7 +395,7 @@ export class CodeApplication extends Disposable {
389
395
this . _register ( new ProxyAuthHandler ( ) ) ;
390
396
391
397
// Open Windows
392
- const windows = appInstantiationService . invokeFunction ( accessor => this . openFirstWindow ( accessor , electronIpcServer , sharedProcessReady ) ) ;
398
+ const windows = appInstantiationService . invokeFunction ( accessor => this . openFirstWindow ( accessor , electronIpcServer , sharedProcessClient ) ) ;
393
399
394
400
// Post Open Windows Tasks
395
401
this . afterWindowOpen ( ) ;
@@ -425,7 +431,7 @@ export class CodeApplication extends Disposable {
425
431
return { machineId, trueMachineId } ;
426
432
}
427
433
428
- private async createServices ( machineId : string , trueMachineId : string | undefined , sharedProcess : SharedProcess , sharedProcessClient : Promise < Client < string > > ) : Promise < IInstantiationService > {
434
+ private async createServices ( machineId : string , trueMachineId : string | undefined , sharedProcess : SharedProcess , sharedProcessReady : Promise < Client < string > > ) : Promise < IInstantiationService > {
429
435
const services = new ServiceCollection ( ) ;
430
436
431
437
const fileService = this . _register ( new FileService ( this . logService ) ) ;
@@ -457,7 +463,7 @@ export class CodeApplication extends Disposable {
457
463
services . set ( ISharedProcessMainService , new SyncDescriptor ( SharedProcessMainService , [ sharedProcess ] ) ) ;
458
464
services . set ( ILaunchMainService , new SyncDescriptor ( LaunchMainService ) ) ;
459
465
460
- const diagnosticsChannel = getDelayedChannel ( sharedProcessClient . then ( client => client . getChannel ( 'diagnostics' ) ) ) ;
466
+ const diagnosticsChannel = getDelayedChannel ( sharedProcessReady . then ( client => client . getChannel ( 'diagnostics' ) ) ) ;
461
467
services . set ( IDiagnosticsService , new SyncDescriptor ( DiagnosticsService , [ diagnosticsChannel ] ) ) ;
462
468
463
469
services . set ( IIssueService , new SyncDescriptor ( IssueMainService , [ machineId , this . userEnv ] ) ) ;
@@ -478,7 +484,7 @@ export class CodeApplication extends Disposable {
478
484
479
485
// Telemetry
480
486
if ( ! this . environmentService . isExtensionDevelopment && ! this . environmentService . args [ 'disable-telemetry' ] && ! ! product . enableTelemetry ) {
481
- const channel = getDelayedChannel ( sharedProcessClient . then ( client => client . getChannel ( 'telemetryAppender' ) ) ) ;
487
+ const channel = getDelayedChannel ( sharedProcessReady . then ( client => client . getChannel ( 'telemetryAppender' ) ) ) ;
482
488
const appender = combinedAppender ( new TelemetryAppenderClient ( channel ) , new LogAppender ( this . logService ) ) ;
483
489
const commonProperties = resolveCommonProperties ( product . commit , product . version , machineId , product . msftInternalDomains , this . environmentService . installSourcePath ) ;
484
490
const piiPaths = this . environmentService . extensionsPath ? [ this . environmentService . appRoot , this . environmentService . extensionsPath ] : [ this . environmentService . appRoot ] ;
@@ -572,6 +578,7 @@ export class CodeApplication extends Disposable {
572
578
const storageMainService = accessor . get ( IStorageMainService ) ;
573
579
const storageChannel = this . _register ( new GlobalStorageDatabaseChannel ( this . logService , storageMainService ) ) ;
574
580
electronIpcServer . registerChannel ( 'storage' , storageChannel ) ;
581
+ sharedProcessClient . then ( client => client . registerChannel ( 'storage' , storageChannel ) ) ;
575
582
576
583
const loggerChannel = new LoggerChannel ( accessor . get ( ILogService ) ) ;
577
584
electronIpcServer . registerChannel ( 'logger' , loggerChannel ) ;
0 commit comments