From bf1b64008f0c6948bd6dd8d01b8ec06392c5add9 Mon Sep 17 00:00:00 2001 From: Salman Muin Kayser Chishti Date: Mon, 8 Dec 2025 12:35:33 +0000 Subject: [PATCH] fix: use detached:true on all platforms for exec stream tests On Windows, detached:true is needed to properly keep stdio handles open after the parent process exits. --- packages/exec/__tests__/scripts/spawn-wait-for-file.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/exec/__tests__/scripts/spawn-wait-for-file.js b/packages/exec/__tests__/scripts/spawn-wait-for-file.js index 6c777491..720b7849 100644 --- a/packages/exec/__tests__/scripts/spawn-wait-for-file.js +++ b/packages/exec/__tests__/scripts/spawn-wait-for-file.js @@ -19,9 +19,14 @@ if (!filePath) { // This creates a grandchild process that holds the stdio handles open // after this process (the child) exits const waitScript = path.join(__dirname, 'wait-for-file.js') +const isWindows = process.platform === 'win32' + +// On Windows, use detached:true to properly keep streams open +// On Unix, detached:true also works and creates a new process group const child = childProcess.spawn(process.execPath, [waitScript, `file=${filePath}`], { stdio: ['ignore', 'inherit', 'inherit'], - detached: process.platform !== 'win32' + detached: true, + windowsHide: true }) // Don't wait for child to exit