Skip to main content

output_string

Function output_string 

Source
pub async fn output_string<I, S>(
    program: impl AsRef<OsStr>,
    args: I,
) -> Result<ProcessResult<String>>
where I: IntoIterator<Item = S>, S: AsRef<OsStr>,
Expand description

Run program with args inside a private job and capture the result without erroring on a non-zero exit — for commands whose exit code is meaningful.

§Errors

The same surface as Command::output_string: a non-zero exit, a timeout, and a signal-kill are captured in the returned ProcessResult, not raised; beyond a launch failure, only ErrorReason::Cancelled, ErrorReason::OutputTooLarge, ErrorReason::Stdin, and ErrorReason::Io surface.