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>
This commit is contained in:
7418andClaude Opus 4.6 committed 2026-02-13 17:56:40 +08:00
1 parent 4472d21028
commit 332b62bbe0
2 files changed
+16 -5

No files matched your search

+14 -4
View File
@@ -55,9 +55,15 @@ function killServer(): Promise<void> {
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<void> {
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();
}
});
}