pub trait CommandTimeoutExt {
// Required methods
fn output_timeout(&mut self, timeout: Duration) -> Result<Output>;
fn output_timeout_capped(
&mut self,
timeout: Duration,
cap: usize,
) -> Result<Output>;
}Expand description
Drop-in replacement for Command::output that bounds the wait.
Required Methods§
Sourcefn output_timeout(&mut self, timeout: Duration) -> Result<Output>
fn output_timeout(&mut self, timeout: Duration) -> Result<Output>
Run the command to completion, capturing its output, but kill it and
return a TimedOut error if it runs longer than timeout.
Sourcefn output_timeout_capped(
&mut self,
timeout: Duration,
cap: usize,
) -> Result<Output>
fn output_timeout_capped( &mut self, timeout: Duration, cap: usize, ) -> Result<Output>
Like output_timeout but retains at most
cap bytes of each of stdout/stderr, draining and discarding the
rest. Bounds memory on the capture path (the hook Test button) so a
flooding command can’t balloon the buffer before truncation (#213).
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".