tests(exec): use platform-aware spawn options in spawn-wait-for-file script (detach on Unix, hide window on Windows)

This commit is contained in:
Salman Muin Kayser Chishti
2025-11-18 15:45:59 +00:00
parent df111e1104
commit d97deb1f60
@@ -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') {