From 9da06d918fbfab7850ada774ee85d905d8aff650 Mon Sep 17 00:00:00 2001 From: MoerAI Date: Fri, 13 Mar 2026 16:40:26 +0900 Subject: [PATCH] fix(windows): add windowsHide to detached spawn calls to suppress console windows (#44693) The restart helper and taskkill spawn calls were missing windowsHide: true, causing visible command prompt windows to flash on screen during gateway restart and process cleanup on Windows. --- src/cli/update-cli/restart-helper.test.ts | 3 +++ src/cli/update-cli/restart-helper.ts | 1 + src/process/kill-tree.ts | 1 + 3 files changed, 5 insertions(+) diff --git a/src/cli/update-cli/restart-helper.test.ts b/src/cli/update-cli/restart-helper.test.ts index c8b59d69afa..847893e9f23 100644 --- a/src/cli/update-cli/restart-helper.test.ts +++ b/src/cli/update-cli/restart-helper.test.ts @@ -287,6 +287,7 @@ describe("restart-helper", () => { expect(spawn).toHaveBeenCalledWith("/bin/sh", [scriptPath], { detached: true, stdio: "ignore", + windowsHide: true, }); expect(mockChild.unref).toHaveBeenCalled(); }); @@ -302,6 +303,7 @@ describe("restart-helper", () => { expect(spawn).toHaveBeenCalledWith("cmd.exe", ["/d", "/s", "/c", scriptPath], { detached: true, stdio: "ignore", + windowsHide: true, }); expect(mockChild.unref).toHaveBeenCalled(); }); @@ -317,6 +319,7 @@ describe("restart-helper", () => { expect(spawn).toHaveBeenCalledWith("cmd.exe", ["/d", "/s", "/c", `"${scriptPath}"`], { detached: true, stdio: "ignore", + windowsHide: true, }); }); }); diff --git a/src/cli/update-cli/restart-helper.ts b/src/cli/update-cli/restart-helper.ts index c27f25cdc49..a68fab161fa 100644 --- a/src/cli/update-cli/restart-helper.ts +++ b/src/cli/update-cli/restart-helper.ts @@ -169,6 +169,7 @@ export async function runRestartScript(scriptPath: string): Promise { const child = spawn(file, args, { detached: true, stdio: "ignore", + windowsHide: true, }); child.unref(); } diff --git a/src/process/kill-tree.ts b/src/process/kill-tree.ts index e3f83f63a0e..6f0d752e4c5 100644 --- a/src/process/kill-tree.ts +++ b/src/process/kill-tree.ts @@ -83,6 +83,7 @@ function runTaskkill(args: string[]): void { spawn("taskkill", args, { stdio: "ignore", detached: true, + windowsHide: true, }); } catch { // Ignore taskkill spawn failures