Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
silence windows taskkill cleanup output
  • Loading branch information
ndycode committed May 1, 2026
commit 4437ef356564046331097ee6df06a7f70b31801d
9 changes: 7 additions & 2 deletions lib/auto-update-checker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -537,8 +537,13 @@ function taskkillProcessTree(pid: number): Promise<boolean> {
timeout.unref?.();
try {
const killer = spawn(
"taskkill",
["/PID", String(pid), "/T", "/F"],
"cmd.exe",
[
"/d",
"/s",
"/c",
`taskkill /PID ${pid} /T /F >NUL 2>NUL`,
],
{
stdio: "ignore",
windowsHide: true,
Expand Down
11 changes: 10 additions & 1 deletion scripts/test-model-matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,15 @@ function runQuiet(command, commandArgs) {
}
}

function runQuietWindowsTaskkill(pid) {
runQuiet("cmd.exe", [
"/d",
"/s",
"/c",
`taskkill /F /T /PID ${pid} >NUL 2>NUL`,
]);
}

export function registerSpawnedCodex(pid) {
if (!Number.isInteger(pid) || pid <= 0) return;
spawnedCodexPids.add(pid);
Expand Down Expand Up @@ -228,7 +237,7 @@ function stopCodexServersInternal() {
spawnedCodexPids.clear();
for (const pid of tracked) {
if (process.platform === "win32") {
runQuiet("taskkill", ["/F", "/T", "/PID", String(pid)]);
runQuietWindowsTaskkill(pid);
continue;
}
runQuiet("kill", ["-9", String(pid)]);
Expand Down
9 changes: 7 additions & 2 deletions test/auto-update-checker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -889,8 +889,13 @@ describe("auto-update-checker", () => {
await flushUpdateStartup();
await vi.advanceTimersByTimeAsync(25);
expect(childProcess.spawn).toHaveBeenLastCalledWith(
"taskkill",
["/PID", "1234", "/T", "/F"],
"cmd.exe",
[
"/d",
"/s",
"/c",
"taskkill /PID 1234 /T /F >NUL 2>NUL",
],
expect.objectContaining({ stdio: "ignore", windowsHide: true }),
);
killer.emit("exit", 0, null);
Expand Down
8 changes: 4 additions & 4 deletions test/test-model-matrix-script.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,14 +246,14 @@ describe("test-model-matrix script helpers", () => {
expect(spawnSync).toHaveBeenCalledTimes(2);
expect(spawnSync).toHaveBeenNthCalledWith(
1,
"taskkill",
["/F", "/T", "/PID", "1001"],
"cmd.exe",
["/d", "/s", "/c", "taskkill /F /T /PID 1001 >NUL 2>NUL"],
expect.objectContaining({ windowsHide: true, stdio: "ignore" }),
);
expect(spawnSync).toHaveBeenNthCalledWith(
2,
"taskkill",
["/F", "/T", "/PID", "2002"],
"cmd.exe",
["/d", "/s", "/c", "taskkill /F /T /PID 2002 >NUL 2>NUL"],
expect.objectContaining({ windowsHide: true, stdio: "ignore" }),
);
} finally {
Expand Down