Skip to main content

run_with_progress

Function run_with_progress 

Source
pub async fn run_with_progress<R: ProcessRunner + ?Sized>(
    runner: &R,
    command: &Command,
    progress: &mut ProgressCallback<'_>,
) -> Result<()>
Expand description

Run one command while forwarding its lifecycle and output events.

events() and finish() are deliberately driven concurrently: the terminal Exited event is published by the finisher, so draining the stream first would deadlock. Output lines are also retained locally so a rejected exit is promoted to the same structured processkit error shape as run_unit, with the command’s stdout/stderr available to classifiers.

This function observes exactly one process lifecycle and therefore does not apply a command/client retry policy: Exited is always the final event. A caller that wants to replay a failed streamed operation can decide that explicitly after receiving the terminal event and returned error.

Retention is unbounded, the pre-budget behaviour: every streamed line is kept until the process exits. Bound it with run_with_progress_within — the streaming counterpart of ManagedClient::budget_diagnostics — when the command can produce a lot of output (clone/fetch --progress on a large repository).