Skip to content

Commit 309e6b9

Browse files
authored
fix: app update from toast notification (#660)
* fix: app update from toast notification * enable prerelease * remove pre-release * refactor: remove delay unneeded
1 parent 7043200 commit 309e6b9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

main/src/main.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -547,7 +547,12 @@ ipcMain.handle('install-update-and-restart', async () => {
547547
tearingDown = true
548548
isUpdateInProgress = true
549549

550-
// Stop ToolHive and servers immediately without graceful shutdown
550+
app.removeAllListeners('before-quit')
551+
app.removeAllListeners('will-quit')
552+
553+
log.info('🛑 Starting graceful shutdown before update...')
554+
mainWindow?.webContents.send('graceful-exit')
555+
551556
try {
552557
const port = getToolhivePort()
553558
if (port) {
@@ -566,6 +571,9 @@ ipcMain.handle('install-update-and-restart', async () => {
566571
tray?.destroy()
567572

568573
// Install update and restart
574+
log.info(
575+
'[restart from toast] all cleaned up, calling autoUpdater.quitAndInstall()...'
576+
)
569577
autoUpdater.quitAndInstall()
570578
return { success: true }
571579
})

0 commit comments

Comments
 (0)