fix updater marker ordering and shutdown guard test

This commit is contained in:
Merge Sim
2026-09-03 13:53:38 -07:00
parent 63d37bb273
commit a29a397e55
2 changed files with 5 additions and 5 deletions
@@ -100,16 +100,16 @@ export abstract class UpdaterInstallExecution extends UpdaterPackageRecovery {
recordUpdaterLifecycle('quit_and_install_invoking_native', {
version: pendingVersion || null
})
// Why: defensive — never call quitAndInstall if recovery/reset already cleared the handoff.
if (!this.quitAndInstallInProgress) {
return
}
// Why before the native call: from here ShipIt waits for this process to exit, and any
// launch of this bundle in that window cancels the install. The marker is the only way
// a launching process can know that, because this process is about to be gone.
if (process.platform === 'darwin') {
markMacUpdateInstallInFlight(pendingVersion)
}
// Why: defensive — never call quitAndInstall if recovery/reset already cleared the handoff.
if (!this.quitAndInstallInProgress) {
return
}
// Why: mark before the call so a sync 'error' during quitAndInstall can recover; pre-native errors must not look like install failure.
this.quitAndInstallNativeInvoked = true
// Why: invoke before killAllPty/removing close listeners so a sync 'error' can recover while windows and PTYs are intact.
@@ -193,7 +193,7 @@ describe('createShutdownCheckpointGuard', () => {
join(process.cwd(), 'src/renderer/src/components/use-terminal-editor-close-foundation.ts'),
'utf8'
)
const closeStart = source.indexOf('const confirmNativeWindowClose = useCallback(() => {')
const closeStart = source.indexOf('const confirmNativeWindowClose = useCallback(')
const closeEnd = source.indexOf('window.api.ui.confirmWindowClose()', closeStart)
expect(closeStart).toBeGreaterThanOrEqual(0)
expect(closeEnd).toBeGreaterThan(closeStart)