Skip to main content

capture_allowing_failure

Function capture_allowing_failure 

Source
pub fn capture_allowing_failure(
    program: &str,
    args: &[&str],
    cwd: &Path,
    timeout: Duration,
) -> Result<CapturedCommand>
Expand description

Run a command and hand back what it printed, whether or not it worked.

devp caches containers needs the difference between “docker is not installed” and “docker is installed and its daemon is not running”, and the second only exists in what the failed command wrote to stderr. Every other caller wants capture_command_with_timeout, which turns a non-zero exit into an error.

Err here is narrower than it looks: the process could not be spawned at all, or it outlived timeout. A command that ran and failed is Ok with ok: false.