Skip to main content

capture_command_with_timeout

Function capture_command_with_timeout 

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

Run a command and hand back what it printed on stdout, bounded by timeout.

For commands that answer a question instead of doing work. A non-zero exit is an error like anywhere else, so a caller never mistakes an error message on stderr for the answer it asked for.