Skip to main content

run_and_capture

Function run_and_capture 

Source
pub fn run_and_capture(
    cmd: &str,
    cwd: &Path,
    on_stdout: impl FnMut(&str),
    on_stderr: impl FnMut(&str),
) -> Result<CapturedOutput, String>
Expand description

Run a shell command, capture its output, and return the result.

Output is captured up to MAX_CAPTURE_BYTES. The on_stdout and on_stderr callbacks are called for each line as it arrives (for real-time terminal streaming).