[−][src]Trait process_control::ChildExt
Extensions to Child
for easily terminating processes.
For more information, see the module-level documentation.
Required methods
fn terminator(&self) -> IoResult<Terminator>
Creates an instance of Terminator
for this process.
Examples
use std::process::Command; use process_control::ChildExt; let process = Command::new("echo").spawn()?; let terminator = process.terminator()?;
#[must_use]
fn with_timeout(&mut self, time_limit: Duration) -> _ExitStatusTimeout
Creates an instance of _ExitStatusTimeout
for this process.
This method parallels Child::wait
when the process must finish
within a time limit.
Examples
use std::process::Command; use std::time::Duration; use process_control::ChildExt; let exit_status = Command::new("echo") .spawn()? .with_timeout(Duration::from_secs(1)) .terminating() .wait()? .expect("process timed out"); assert!(exit_status.success());
#[must_use]
fn with_output_timeout(self, time_limit: Duration) -> _OutputTimeout
Creates an instance of _OutputTimeout
for this process.
This method parallels Child::wait_with_output
when the process must
finish within a time limit.
Examples
use std::process::Command; use std::time::Duration; use process_control::ChildExt; let output = Command::new("echo") .spawn()? .with_output_timeout(Duration::from_secs(1)) .terminating() .wait()? .expect("process timed out"); assert!(output.status.success());