Skip to content

Commit 332b62b

Browse files
7418claude
andcommitted
fix: prevent uninstall from deleting user files and fix Windows process cleanup
Two fixes for critical Windows issues (#81): 1. NSIS installer: disable allowToChangeInstallationDirectory to prevent users from installing into shared directories where uninstall would delete all their files. Also set deleteAppDataOnUninstall: false to preserve user data. 2. Windows process cleanup: killServer() used SIGTERM which Windows doesn't support, leaving zombie processes that block updates. Now uses taskkill /T /F to kill the entire process tree on Windows, ensuring no residual processes remain after app exit. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 4472d21 commit 332b62b

File tree

2 files changed

+16
-5
lines changed

2 files changed

+16
-5
lines changed

electron-builder.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,10 @@ win:
5454
nsis:
5555
oneClick: false
5656
perMachine: false
57-
allowToChangeInstallationDirectory: true
57+
allowToChangeInstallationDirectory: false
5858
createDesktopShortcut: true
5959
createStartMenuShortcut: true
60+
deleteAppDataOnUninstall: false
6061
linux:
6162
icon: build/icon.png
6263
category: Development

electron/main.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,15 @@ function killServer(): Promise<void> {
5555
const pid = serverProcess.pid;
5656

5757
const timeout = setTimeout(() => {
58-
// Force kill via Node's process.kill with SIGKILL
58+
// Force kill — on Windows use taskkill to kill the entire process tree
5959
if (pid) {
60-
try { process.kill(pid, 'SIGKILL'); } catch { /* already dead */ }
60+
try {
61+
if (process.platform === 'win32') {
62+
spawn('taskkill', ['/T', '/F', '/PID', String(pid)], { stdio: 'ignore' });
63+
} else {
64+
process.kill(pid, 'SIGKILL');
65+
}
66+
} catch { /* already dead */ }
6167
}
6268
serverProcess = null;
6369
resolve();
@@ -69,8 +75,12 @@ function killServer(): Promise<void> {
6975
resolve();
7076
});
7177

72-
// UtilityProcess.kill() sends SIGTERM
73-
serverProcess.kill();
78+
// On Windows, SIGTERM is not supported — use taskkill to kill the tree
79+
if (process.platform === 'win32' && pid) {
80+
spawn('taskkill', ['/T', '/F', '/PID', String(pid)], { stdio: 'ignore' });
81+
} else {
82+
serverProcess.kill();
83+
}
7484
});
7585
}
7686

0 commit comments

Comments
 (0)