fix: Windows 下 Claude 进程和 taskkill 不再弹出 CMD 窗口

- spawn 改为 detached: !IS_WIN(Windows 子进程默认独立存活,无需 detached)
- taskkill 增加 stdio: 'ignore' 防止弹窗

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Daniel
2026-03-08 12:50:38 +00:00
parent 9485581f90
commit e83ffdd848

View File

@@ -300,7 +300,7 @@ function killProcess(pid, force = false) {
if (IS_WIN) {
const args = ['/T', '/PID', String(pid)];
if (force) args.unshift('/F');
spawn('taskkill', args, { windowsHide: true });
spawn('taskkill', args, { windowsHide: true, stdio: 'ignore' });
} else {
process.kill(pid, force ? 'SIGKILL' : 'SIGTERM');
}
@@ -1077,7 +1077,7 @@ function handleMessage(ws, msg) {
env,
cwd: process.env.HOME || process.env.USERPROFILE || process.cwd(),
stdio: [inputFd, outputFd, errorFd],
detached: true,
detached: !IS_WIN,
windowsHide: true,
});
} catch (err) {