fix: make cli check lightweight by default

This commit is contained in:
Codex
2026-05-17 07:04:21 +00:00
parent 8fd3ccd986
commit 82745d76b2
6 changed files with 177 additions and 41 deletions
+8 -2
View File
@@ -7,20 +7,26 @@ export interface CommandResult {
exitCode: number | null;
stdout: string;
stderr: string;
signal: NodeJS.Signals | null;
timedOut: boolean;
}
export function runCommand(command: string[], cwd: string): CommandResult {
export function runCommand(command: string[], cwd: string, options: { timeoutMs?: number } = {}): CommandResult {
const result = spawnSync(command[0], command.slice(1), {
cwd,
encoding: "utf8",
maxBuffer: 1024 * 1024 * 8,
timeout: options.timeoutMs,
});
const error = result.error as (Error & { code?: string }) | undefined;
return {
command,
cwd,
exitCode: result.status,
stdout: result.stdout ?? "",
stderr: result.stderr ?? result.error?.message ?? "",
stderr: result.stderr ?? error?.message ?? "",
signal: result.signal,
timedOut: error?.code === "ETIMEDOUT",
};
}