Skip to content

Commit 41dd792

Browse files
authored
Restore Ready state if quit is vetoed during quitAndInstall() (#308334)
Restore Ready state if quit is vetoed during quitAndInstall() (#308314)
1 parent 53fb310 commit 41dd792

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

src/vs/platform/update/electron-main/abstractUpdateService.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,12 +341,17 @@ export abstract class AbstractUpdateService implements IUpdateService {
341341
}
342342
}
343343

344+
// Remember the Ready state so we can restore it if the quit is vetoed
345+
const readyState = this.state;
346+
344347
this.setState(State.Restarting(this.state.update));
345348
this.logService.trace('update#quitAndInstall(): before lifecycle quit()');
346349

347350
this.lifecycleMainService.quit(true /* will restart */).then(vetod => {
348351
this.logService.trace(`update#quitAndInstall(): after lifecycle quit() with veto: ${vetod}`);
349352
if (vetod) {
353+
this.logService.info('update#quitAndInstall(): quit was vetoed, restoring Ready state');
354+
this.setState(readyState);
350355
return;
351356
}
352357

src/vs/platform/update/electron-main/updateService.snap.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,17 @@ abstract class AbstractUpdateService implements IUpdateService {
115115
return Promise.resolve(undefined);
116116
}
117117

118+
// Remember the Ready state so we can restore it if the quit is vetoed
119+
const readyState = this.state;
120+
121+
this.setState(State.Restarting(this.state.update));
118122
this.logService.trace('update#quitAndInstall(): before lifecycle quit()');
119123

120124
this.lifecycleMainService.quit(true /* will restart */).then(vetod => {
121125
this.logService.trace(`update#quitAndInstall(): after lifecycle quit() with veto: ${vetod}`);
122126
if (vetod) {
127+
this.logService.info('update#quitAndInstall(): quit was vetoed, restoring Ready state');
128+
this.setState(readyState);
123129
return;
124130
}
125131

0 commit comments

Comments
 (0)