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