From 4d30746a1b83caded12f60acff685956111fb293 Mon Sep 17 00:00:00 2001 From: Matt Van Horn <455140+mvanhorn@users.noreply.github.com> Date: Thu, 4 Jun 2026 07:35:28 -0700 Subject: [PATCH] fix: hide the detached server windows too (folds in #1863) --- browse/src/cli.ts | 3 ++- browse/test/cli-windows-hide.test.ts | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/browse/src/cli.ts b/browse/src/cli.ts index 9803c2c3b..516fb6eb3 100644 --- a/browse/src/cli.ts +++ b/browse/src/cli.ts @@ -326,7 +326,7 @@ async function startServer(extraEnv?: Record): Promise): Promise { expect(hiddenIcaclsCalls).toHaveLength(2); }); }); + +describe('detached server spawns carry windowsHide (#1863 fold-in)', () => { + test('Windows Node launcher inner spawn carries windowsHide:true', () => { + const body = read(CLI); + expect(body).toMatch(/spawn\(process\.execPath,[\s\S]{0,500}detached:true,windowsHide:true/); + }); + + test('non-Windows server nodeSpawn carries windowsHide:true', () => { + const body = read(CLI); + expect(body).toMatch(/nodeSpawn\('bun',[\s\S]{0,500}detached:\s*true[\s\S]{0,100}windowsHide:\s*true/); + }); + + test('every detached spawn site in cli.ts carries windowsHide:true', () => { + const body = read(CLI); + const detachedSpawns = body.match(/detached:\s*true/g)?.length ?? 0; + const windowsHideFlags = body.match(/windowsHide:\s*true/g)?.length ?? 0; + expect(windowsHideFlags).toBeGreaterThanOrEqual(detachedSpawns); + }); +});