From d97deb1f60b8c037c927a79b1578c547c4787915 Mon Sep 17 00:00:00 2001 From: Salman Muin Kayser Chishti Date: Tue, 18 Nov 2025 15:45:59 +0000 Subject: [PATCH] tests(exec): use platform-aware spawn options in spawn-wait-for-file script (detach on Unix, hide window on Windows) --- .../__tests__/scripts/spawn-wait-for-file.js | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/packages/exec/__tests__/scripts/spawn-wait-for-file.js b/packages/exec/__tests__/scripts/spawn-wait-for-file.js index 31a6cd0d..09e6a912 100644 --- a/packages/exec/__tests__/scripts/spawn-wait-for-file.js +++ b/packages/exec/__tests__/scripts/spawn-wait-for-file.js @@ -24,11 +24,23 @@ if (!filePath) { const waitScript = path.join(__dirname, 'wait-for-file.js') const waitArgs = [waitScript, `file=${filePath}`] -const waitProcess = childProcess.spawn(process.execPath, waitArgs, { - stdio: 'inherit', - detached: false -}) +// Spawn with inherited stdio and detached on Unix, non-detached on Windows +// This keeps the streams open after parent exits +const isWindows = process.platform === 'win32' +const spawnOptions = { + stdio: 'inherit', + detached: !isWindows +} + +// On Windows, we need to hide the window +if (isWindows) { + spawnOptions.windowsHide = true +} + +const waitProcess = childProcess.spawn(process.execPath, waitArgs, spawnOptions) + +// Unref so parent doesn't wait for child waitProcess.unref() if (args.stderr === 'true') {