Skip to main content

execute

Function execute 

Source
pub fn execute(
    cmd: Command,
    program: &str,
    stdin: Option<String>,
) -> ValueResult<Output>
Expand description

Spawn cmd, feed stdin, drain stdout/stderr, wait.

stdin is written from its own thread while wait_with_output drains, so a child that answers before it finishes reading cannot deadlock the pipes. A child that exits unread makes the write fail with EPIPE (Rust ignores SIGPIPE); that is the child’s choice, not an error of the call.