diff --git a/src/vs/code/electron-main/app.ts b/src/vs/code/electron-main/app.ts index a7ff00e9..cbe9fe7e 100644 --- a/src/vs/code/electron-main/app.ts +++ b/src/vs/code/electron-main/app.ts @@ -637,6 +637,7 @@ export class CodeApplication extends Disposable { //install window wait to do by dll if (await this.isFirstLoad() && this.productService.deployFunc) { + this.lifecycleMainService.appQuitFlagDeploy = true; await appInstantiationService.invokeFunction(accessor => this.openDeploylWindow(accessor)); } @@ -1376,7 +1377,7 @@ export class CodeApplication extends Disposable { DeployMainService.openDeployWindow(true).then(() => { resolve(void 0); }).catch((error) => { - console.log(error); + this.logService.info(`appts openDeploylWindow ${error}`); resolve(-1); }) }); diff --git a/src/vs/platform/issue/electron-main/deployMainService.ts b/src/vs/platform/issue/electron-main/deployMainService.ts index df85148d..40f990f9 100644 --- a/src/vs/platform/issue/electron-main/deployMainService.ts +++ b/src/vs/platform/issue/electron-main/deployMainService.ts @@ -16,6 +16,7 @@ import { validatedIpcMain } from 'vs/base/parts/ipc/electron-main/ipcMain'; import { IEnvironmentMainService } from 'vs/platform/environment/electron-main/environmentMainService'; import { IDeployMainService, DeployWindowConfiguration, DeployData } from 'vs/platform/issue/common/deploy'; import { ILogger } from 'vs/platform/log/common/log'; +import { ILogService } from 'vs/platform/log/common/log'; import { ILoggerMainService } from 'vs/platform/log/electron-main/loggerService'; import { INativeHostMainService } from 'vs/platform/native/electron-main/nativeHostMainService'; import product from 'vs/platform/product/common/product'; @@ -122,6 +123,7 @@ export class DeployMainService implements IDeployMainService { constructor( private userEnv: IProcessEnvironment, @IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService, + @ILogService private readonly logService: ILogService, @ILoggerMainService private readonly loggerMainService: ILoggerMainService, @IProtocolMainService private readonly protocolMainService: IProtocolMainService, @INativeHostMainService private readonly nativeHostMainService: INativeHostMainService, @@ -200,6 +202,7 @@ export class DeployMainService implements IDeployMainService { }; listenerCloseWindow = (event: IpcMainEvent, msg: any) => { if (msg.type === 'skip') { + this.logService.info("跳过配置"); this.logger.info("跳过配置"); } if (msg.type === "close") { @@ -210,6 +213,7 @@ export class DeployMainService implements IDeployMainService { fs.rmdirSync(this.updateConfigDir, { recursive: true }); } } + this.logService.info("opendeploywindo listenerCloseWindow"); this.closeWindow(); }; @@ -1174,6 +1178,7 @@ export class DeployMainService implements IDeployMainService { } closeWindow() { + this.logService.info("deploywindow closeWindow"); if (this.DeployWindow) { if (this.installProcessId) { this.installProcessId.kill(); @@ -1237,7 +1242,7 @@ export class DeployMainService implements IDeployMainService { try { DeployDisposables.dispose(); } catch { - this.logger.error("deployDisposables.dispose() catch"); + this.logger.info("deployDisposables.dispose"); } resolve(void 0); diff --git a/src/vs/platform/lifecycle/electron-main/lifecycleMainService.ts b/src/vs/platform/lifecycle/electron-main/lifecycleMainService.ts index 82640175..af55146a 100644 --- a/src/vs/platform/lifecycle/electron-main/lifecycleMainService.ts +++ b/src/vs/platform/lifecycle/electron-main/lifecycleMainService.ts @@ -84,6 +84,8 @@ export interface IRelaunchOptions { export interface ILifecycleMainService { + appQuitFlagDeploy: boolean; + readonly _serviceBrand: undefined; /** @@ -244,6 +246,7 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe private readonly phaseWhen = new Map(); private relaunchHandler: IRelaunchHandler | undefined = undefined; + public appQuitFlagDeploy: boolean = false; constructor( @ILogService private readonly logService: ILogService, @@ -251,7 +254,6 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe @IEnvironmentMainService private readonly environmentMainService: IEnvironmentMainService ) { super(); - this.resolveRestarted(); this.when(LifecycleMainPhase.Ready).then(() => this.registerListeners()); } @@ -298,7 +300,11 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe // Windows/Linux: we quit when all windows have closed // Mac: we only quit when quit was requested - if (this._quitRequested || !isMacintosh) { + if (this.appQuitFlagDeploy) { + this.appQuitFlagDeploy = false; + return; + } + if ((!this.appQuitFlagDeploy) && (this._quitRequested || !isMacintosh)) { app.quit(); } }; @@ -412,6 +418,7 @@ export class LifecycleMainService extends Disposable implements ILifecycleMainSe } registerWindow(window: ICodeWindow): void { + this.appQuitFlagDeploy = false; const windowListeners = new DisposableStore(); // track window count diff --git a/src/vs/platform/test/electron-main/workbenchTestServices.ts b/src/vs/platform/test/electron-main/workbenchTestServices.ts index 639f1fab..ea7e27ca 100644 --- a/src/vs/platform/test/electron-main/workbenchTestServices.ts +++ b/src/vs/platform/test/electron-main/workbenchTestServices.ts @@ -15,7 +15,7 @@ export class TestLifecycleMainService implements ILifecycleMainService { _serviceBrand: undefined; onBeforeShutdown = Event.None; - + appQuitFlagDeploy: boolean = false; private readonly _onWillShutdown = new Emitter(); readonly onWillShutdown = this._onWillShutdown.event;