Skip to content

Commit 56212cb

Browse files
committed
Fix driver.ts TS2769 when passing stdio to execFile
ExecFileOptions doesn't declare stdio (it lives on CommonSpawnOptions), but execFile forwards the option to spawn() at runtime. Cast through ExecFileOptions so the stdio-ignore path compiles.
1 parent 05d199f commit 56212cb

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

tests/driver/driver.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -391,16 +391,16 @@ export abstract class GenericTrunkDriver {
391391
const { stdin: stdinData, ...fileOpts } = execOptions ?? {};
392392
// Avoid racing our empty-stdin write against short-lived children (e.g.
393393
// `foo --version`): when the caller has no stdin payload, give the child
394-
// a closed stdin up front so nothing can emit EPIPE later.
395-
const stdio: ("ignore" | "pipe")[] = stdinData
396-
? ["pipe", "pipe", "pipe"]
397-
: ["ignore", "pipe", "pipe"];
394+
// a closed stdin up front so nothing can emit EPIPE later. `stdio` isn't
395+
// in the ExecFileOptions type but execFile forwards it to spawn at
396+
// runtime, so cast through to keep TS happy.
397+
const stdio = stdinData ? "pipe" : (["ignore", "pipe", "pipe"] as const);
398398
const exec = execFile(bin, args, {
399399
cwd: this.sandboxPath,
400400
env: executionEnv(),
401-
stdio,
402401
...fileOpts,
403-
});
402+
stdio,
403+
} as ExecFileOptions);
404404
if (stdinData) {
405405
// Defensively swallow EPIPE if the child still manages to exit first.
406406
// trunk-ignore(eslint/@typescript-eslint/no-empty-function)

0 commit comments

Comments
 (0)