[−][src]Struct process_control::ProcessTerminator
A wrapper that stores enough information to terminate a process.
Instances can only be constructed using Terminator::terminator
.
Methods
impl ProcessTerminator
[src]
pub fn terminate(&self) -> IoResult<()>
[src]
Terminates a process as immediately as the operating system allows.
Behavior should be equivalent to calling Child::kill
for the same
process. The guarantees on the result of that method are also
maintained; different ErrorKind
variants may be returned in the
future for the same type of failure. Allowing these breakages is
required to be compatible with the Error
type.
Panics
Panics if the operating system gives conflicting indicators of whether the termination signal was accepted.
Examples
use std::io::Result as IoResult; use std::process::Command; use std::thread; use std::thread::JoinHandle; use process_control::Terminator; let mut process = Command::new("echo").spawn()?; let process_terminator = process.terminator(); let thread: JoinHandle<IoResult<_>> = thread::spawn(move || { process.wait()?; println!("waited"); Ok(()) }); // [process.kill] requires a mutable reference. process_terminator.terminate()?; thread.join().expect("thread panicked")?;
pub fn terminate_if_necessary(&self) -> IoResult<()>
[src]
Terminates a process as immediately as the operating system allows, ignoring errors about the process no longer existing.
For more information, see terminate
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ProcessTerminator
impl Send for ProcessTerminator
impl Sync for ProcessTerminator
impl Unpin for ProcessTerminator
impl UnwindSafe for ProcessTerminator
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,