diff --git a/electron-builder.yml b/electron-builder.yml index 7377a15..9b8c54a 100644 --- a/electron-builder.yml +++ b/electron-builder.yml @@ -54,9 +54,10 @@ win: nsis: oneClick: false perMachine: false - allowToChangeInstallationDirectory: true + allowToChangeInstallationDirectory: false createDesktopShortcut: true createStartMenuShortcut: true + deleteAppDataOnUninstall: false linux: icon: build/icon.png category: Development diff --git a/electron/main.ts b/electron/main.ts index 4936757..9122169 100644 --- a/electron/main.ts +++ b/electron/main.ts @@ -55,9 +55,15 @@ function killServer(): Promise { const pid = serverProcess.pid; const timeout = setTimeout(() => { - // Force kill via Node's process.kill with SIGKILL + // Force kill — on Windows use taskkill to kill the entire process tree if (pid) { - try { process.kill(pid, 'SIGKILL'); } catch { /* already dead */ } + try { + if (process.platform === 'win32') { + spawn('taskkill', ['/T', '/F', '/PID', String(pid)], { stdio: 'ignore' }); + } else { + process.kill(pid, 'SIGKILL'); + } + } catch { /* already dead */ } } serverProcess = null; resolve(); @@ -69,8 +75,12 @@ function killServer(): Promise { resolve(); }); - // UtilityProcess.kill() sends SIGTERM - serverProcess.kill(); + // On Windows, SIGTERM is not supported — use taskkill to kill the tree + if (process.platform === 'win32' && pid) { + spawn('taskkill', ['/T', '/F', '/PID', String(pid)], { stdio: 'ignore' }); + } else { + serverProcess.kill(); + } }); }