Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

fix: updater not work on Windows (#11027)

huangkairan812ed7db15cf
diff --git a/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts b/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts
index 91832244cb7..b913518bc35 100644
--- a/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts
+++ b/apps/desktop/src/main/core/infrastructure/UpdaterManager.ts
@@ -1,7 +1,7 @@
import log from 'electron-log';
import { autoUpdater } from 'electron-updater';
-import { isDev } from '@/const/env';
+import { isDev, isWindows } from '@/const/env';
import { UPDATE_CHANNEL as channel, updaterConfig } from '@/modules/updater/configs';
import { createLogger } from '@/utils/logger';
@@ -144,12 +144,16 @@ export class UpdaterManager {
// Close all windows first to ensure clean exit
logger.info('Closing all windows before update installation...');
const { BrowserWindow, app } = require('electron');
- const allWindows = BrowserWindow.getAllWindows();
- allWindows.forEach((window) => {
- if (!window.isDestroyed()) {
- window.close();
- }
- });
+ // do not close windows and quit first
+ // on Windows, window-all-closed -> app.quit()` can terminate the process before the timer fires
+ if (!isWindows) {
+ const allWindows = BrowserWindow.getAllWindows();
+ allWindows.forEach((window) => {
+ if (!window.isDestroyed()) {
+ window.close();
+ }
+ });
+ }
// Release single instance lock before quitting
// This ensures the new instance can acquire the lock