fix: remove unused _writableRoots arg to exec() function (#762)

I suspect this was done originally so that `execForSandbox()` had a
consistent signature for both the `SandboxType.NONE` and
`SandboxType.MACOS_SEATBELT` cases, but that is not really necessary and
turns out to make the upcoming Landlock support a bit more complicated
to implement, so I had Codex remove it and clean up the call sites.
This commit is contained in:
Michael Bolin
2025-04-30 14:08:27 -07:00
committed by GitHub
parent e6fe8d6fa1
commit 033d379eca
6 changed files with 11 additions and 10 deletions

View File

@@ -45,9 +45,6 @@ export function exec(
// This is a temporary measure to understand what are the common base commands
// until we start persisting and uploading rollouts
const execForSandbox =
sandbox === SandboxType.MACOS_SEATBELT ? execWithSeatbelt : rawExec;
const opts: SpawnOptions = {
timeout: timeoutInMillis || DEFAULT_TIMEOUT_MS,
...(requiresShell(cmd) ? { shell: true } : {}),
@@ -59,7 +56,12 @@ export function exec(
os.tmpdir(),
...additionalWritableRoots,
];
return execForSandbox(cmd, opts, writableRoots, abortSignal);
if (sandbox === SandboxType.MACOS_SEATBELT) {
return execWithSeatbelt(cmd, opts, writableRoots, abortSignal);
}
// SandboxType.NONE (or any other) falls back to the raw exec implementation
return rawExec(cmd, opts, abortSignal);
}
export function execApplyPatch(

View File

@@ -72,7 +72,7 @@ export function execWithSeatbelt(
"--",
...cmd,
];
return exec(fullCommand, opts, writableRoots, abortSignal);
return exec(fullCommand, opts, abortSignal);
}
const READ_ONLY_SEATBELT_POLICY = `

View File

@@ -20,7 +20,6 @@ import * as os from "os";
export function exec(
command: Array<string>,
options: SpawnOptions,
_writableRoots: ReadonlyArray<string>,
abortSignal?: AbortSignal,
): Promise<ExecResult> {
// Adapt command for the current platform (e.g., convert 'ls' to 'dir' on Windows)