Skip to main content

Crate procpilot

Crate procpilot 

Source
Expand description

Production-grade subprocess runner with typed errors, retry, and timeout.

procpilot provides one entry point — the Cmd builder — covering every practical subprocess configuration. Errors are typed: RunError distinguishes spawn failure, non-zero exit, and timeout, each carrying the last 128 KiB of stdout/stderr for diagnosis.

§Quick start

use std::time::Duration;
use procpilot::{Cmd, RunError};

let output = Cmd::new("git")
    .args(["show", "maybe-missing-ref"])
    .timeout(Duration::from_secs(30))
    .run();

match output {
    Ok(o) => println!("{}", o.stdout_lossy()),
    Err(RunError::NonZeroExit { .. }) => { /* ref not found */ }
    Err(e) => return Err(e.into()),
}

§Features

Release history: CHANGELOG.md.

Structs§

Cmd
Builder for a subprocess invocation.
CmdDisplay
Owned snapshot of a command’s program + args, formatted shell-style on Display.
RetryPolicy
How retries are scheduled and which errors trigger them.
RunOutput
Captured output from a successful command.
SpawnedProcess
Handle to a spawned subprocess.

Enums§

Redirection
Where a child process’s stderr (or stdout, when supported) goes.
RunError
Error type for subprocess execution.
StdinData
Input data to feed to a child process’s stdin.

Constants§

STREAM_SUFFIX_SIZE
Maximum bytes of stdout/stderr retained on NonZeroExit and Timeout error variants. Anything beyond this is dropped from the front (FIFO), keeping the most recent output — usually the most relevant for debugging.

Functions§

binary_available
Check whether a binary is available on PATH.
binary_version
Return a binary’s --version output, if available.
default_transient
Default transient-error predicate.

Type Aliases§

BeforeSpawnHook
Hook invoked on std::process::Command immediately before each spawn attempt.