Skip to content

Commit 049cb1f

Browse files
committed
electron/updater: do not force quit when update is ready
let it auto-install after user quits the app
1 parent 016ddcd commit 049cb1f

1 file changed

Lines changed: 10 additions & 24 deletions

File tree

electron/updater.ts

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,40 +13,26 @@ export function initAutoUpdater(
1313
autoUpdater.allowPrerelease = true
1414
}
1515

16-
// On Windows/Linux, don't auto-install — we need to pre-download python-embed first.
17-
// On macOS, python is bundled in the DMG so auto-install is fine.
18-
if (process.platform !== 'darwin') {
19-
autoUpdater.autoInstallOnAppQuit = false
20-
}
21-
16+
// Windows/Linux: best-effort pre-download of python-embed so the new version
17+
// doesn't have to download it on first launch. This doesn't block the update —
18+
// autoInstallOnAppQuit stays true (the default) so the update installs whenever
19+
// the user naturally quits, whether or not the pre-download has finished.
2220
autoUpdater.on('update-downloaded', async (info: UpdateDownloadedEvent) => {
23-
if (process.platform === 'darwin') {
24-
// macOS: python is bundled, just install normally
25-
autoUpdater.quitAndInstall(false, true)
26-
return
27-
}
21+
if (process.platform === 'darwin') return
2822

29-
// Windows/Linux: pre-download python-embed if deps changed before restarting
3023
const newVersion = info.version
31-
logger.info( `[updater] Update downloaded: v${newVersion}, checking python deps...`)
24+
logger.info( `[updater] Update downloaded: v${newVersion}, pre-downloading python deps...`)
3225

3326
try {
3427
const didDownload = await preDownloadPythonForUpdate(newVersion, (progress) => {
35-
// Forward progress to renderer so it can show a "Preparing update..." UI
3628
getMainWindow()?.webContents.send('python-update-progress', progress)
3729
})
38-
39-
if (didDownload) {
40-
logger.info( '[updater] Python pre-download complete, installing update...')
41-
} else {
42-
logger.info( '[updater] No python changes needed, installing update...')
43-
}
30+
logger.info( didDownload
31+
? '[updater] Python pre-download complete'
32+
: '[updater] No python changes needed')
4433
} catch (err) {
45-
// Pre-download failed — install anyway; the app will download at next launch
46-
logger.error( `[updater] Python pre-download failed, proceeding with update: ${err}`)
34+
logger.error( `[updater] Python pre-download failed: ${err}`)
4735
}
48-
49-
autoUpdater.quitAndInstall(false, true)
5036
})
5137

5238
const update = () => {

0 commit comments

Comments
 (0)