fix(updater): improve macOS update handling with forced app.quit() fallback (#196)
This commit is contained in:
@@ -206,9 +206,25 @@ export class AppUpdater extends EventEmitter {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Install update and restart.
|
||||||
|
*
|
||||||
|
* On macOS, electron-updater's MacUpdater still delegates to Squirrel.Mac
|
||||||
|
* internally. Squirrel's quitAndInstall() is unreliable — it sometimes
|
||||||
|
* fails to trigger `before-quit`, leaving the tray close handler to
|
||||||
|
* intercept and hide the window instead of quitting. We force `app.quit()`
|
||||||
|
* after a short grace period as a safety net.
|
||||||
|
*/
|
||||||
quitAndInstall(): void {
|
quitAndInstall(): void {
|
||||||
logger.info('[Updater] quitAndInstall called');
|
logger.info('[Updater] quitAndInstall called');
|
||||||
autoUpdater.quitAndInstall();
|
autoUpdater.quitAndInstall();
|
||||||
|
|
||||||
|
if (process.platform === 'darwin') {
|
||||||
|
setTimeout(() => {
|
||||||
|
logger.warn('[Updater] macOS: forcing app.quit() (Squirrel fallback)');
|
||||||
|
app.quit();
|
||||||
|
}, 3_000).unref();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user