Skip to main content

bounded_output

Function bounded_output 

Source
pub fn bounded_output(command: &mut Command, budget: Duration) -> Option<Output>
Expand description

Run a command and take its output, or give up after budget.

The child is waited for on its own thread so that its pipes are drained while the caller’s clock runs: polling try_wait from here instead would deadlock the moment a child wrote more than a pipe buffer. On expiry the child is killed and None comes back; a caller that cannot say what it wanted must say that, not guess.