diff --git a/src/native/updater.ts b/src/native/updater.ts index d114f3c..1ad838b 100644 --- a/src/native/updater.ts +++ b/src/native/updater.ts @@ -1,5 +1,5 @@ import { Notification, app, ipcMain } from "electron"; -import { exec } from "child_process"; +import { exec, spawn } from "child_process"; import { createWriteStream, mkdirSync, writeFileSync } from "fs"; import { dirname, join } from "path"; import { tmpdir } from "os"; @@ -118,8 +118,13 @@ async function downloadAndInstall(url: string, version: string) { ].join("\r\n"); writeFileSync(batchPath, bat); - // Launch batch detached so it outlives this process - exec(`cmd /C start /B "" "${batchPath}"`); + // Spawn batch truly detached so it outlives this process + const child = spawn("cmd.exe", ["/C", batchPath], { + detached: true, + stdio: "ignore", + windowsHide: false, + }); + child.unref(); setUpdateReady(version); // restart button will just app.exit(0) — batch relaunches } else { await new Promise((resolve, reject) => {