Fix the spawnServeProcess stdio type after making stdin optional
A non-literal first stdio element loses spawn()'s typed-tuple overload entirely (verified on Yggdrasil: tsc failed on the two other, unrelated serve helpers' stdout/stderr going nullable), not just for stdin's varying element. Asserted at the one call site instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
e4e81d1628
commit
72da8862b3
1 changed files with 5 additions and 1 deletions
|
|
@ -2566,11 +2566,15 @@ interface RunningServeProcess {
|
|||
}
|
||||
|
||||
async function spawnServeProcess(name: string, command: ServeCommand): Promise<RunningServeProcess> {
|
||||
// A non-literal first stdio element (it varies per caller) loses `spawn`'s
|
||||
// typed-tuple overload entirely, including for the two fixed "pipe"
|
||||
// elements, so this is asserted rather than inferred: stdout/stderr are
|
||||
// always piped here, and only stdin's presence varies.
|
||||
const child = spawn(command.command, command.args, {
|
||||
cwd: command.cwd,
|
||||
env: { ...process.env, ...command.env },
|
||||
stdio: [command.stdin ?? "ignore", "pipe", "pipe"],
|
||||
});
|
||||
}) as ChildProcessByStdio<Writable | null, Readable, Readable>;
|
||||
const stderr: string[] = [];
|
||||
let stdoutBuffer = "";
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue