Skip to main content

run_cli_command

Function run_cli_command 

Source
pub async fn run_cli_command(
    cmd: &mut Command,
    timeout: Duration,
    max_output_bytes: usize,
) -> Result<CliOutput, RunnerError>
Expand description

Run a CLI command with timeout and output-size limits

The command is spawned as a child process. If it does not exit within timeout, it is killed and an error is returned. Output is capped at max_output_bytes to prevent unbounded memory consumption.

§Errors

Returns RunnerError if:

  • The process cannot be spawned
  • The process exceeds the timeout (killed and reported)

Note: a non-zero exit code is returned inside CliOutput::exit_code as data, not as an error. Callers decide how to handle it.