diff --git a/packages/subprocess/subprocess-local/src/runner-launch.ts b/packages/subprocess/subprocess-local/src/runner-launch.ts index ac1954eec5..34d68f0046 100644 --- a/packages/subprocess/subprocess-local/src/runner-launch.ts +++ b/packages/subprocess/subprocess-local/src/runner-launch.ts @@ -129,7 +129,7 @@ export function runnerStdio( if (!ipc) { if (spec.stdio.control === 'pipe') { while (targetStdio.length < SUBPROCESS_CONTROL_FD) targetStdio.push('ignore') - targetStdio.push('pipe') + targetStdio.push('overlapped') } return targetStdio } @@ -142,7 +142,7 @@ export function runnerStdio( spec.stdio.stdout === 'inherit' ? 1 : 'pipe', spec.stdio.stderr === 'inherit' ? 2 : 'pipe', ] - if (spec.stdio.control === 'pipe') runner.push('pipe') + if (spec.stdio.control === 'pipe') runner.push('overlapped') return runner } diff --git a/packages/subprocess/subprocess-local/src/spawn.ts b/packages/subprocess/subprocess-local/src/spawn.ts index 32d1494a85..9e14842353 100644 --- a/packages/subprocess/subprocess-local/src/spawn.ts +++ b/packages/subprocess/subprocess-local/src/spawn.ts @@ -657,7 +657,7 @@ export function spawnSubprocess(spec: SubprocessSpawnSpec, internals: SpawnInter ] if (spec.stdio.control === 'pipe') { while (stdio.length < SUBPROCESS_CONTROL_FD) stdio.push('ignore') - stdio.push('pipe') + stdio.push('overlapped') } const child = (internals.spawn ?? spawn)(program as string, args, { cwd: spec.cwd, diff --git a/packages/subprocess/subprocess-local/tests/spawn-runner.spec.ts b/packages/subprocess/subprocess-local/tests/spawn-runner.spec.ts index 5c1eb210cc..fe30346c3c 100644 --- a/packages/subprocess/subprocess-local/tests/spawn-runner.spec.ts +++ b/packages/subprocess/subprocess-local/tests/spawn-runner.spec.ts @@ -274,6 +274,9 @@ describe('runner launch inputs', () => { expect(parseRunnerTargetArgv(['--', 'node', 'a'])).toEqual(['node', 'a']) expect(() => parseRunnerTargetArgv(['node'])).toThrow('private -- delimiter') expect(runnerStdio(spec, false)).toEqual(['pipe', 'pipe', 'inherit']) + const withControl = { ...spec, stdio: { ...spec.stdio, control: 'pipe' as const } } + expect(runnerStdio(withControl, false)).toEqual(['pipe', 'pipe', 'inherit', 'ignore', 'ignore', 'ignore', 'ignore', 'overlapped']) + expect(runnerStdio(withControl, true)).toEqual(['ignore', 'ignore', 'ignore', 'ipc', 'pipe', 'pipe', 2, 'overlapped']) expect(runnerStdio(spec, true)).toEqual([ 'ignore', 'ignore', 'ignore', 'ipc', 'pipe', 'pipe', 2, ])