Interruptible

Trait Interruptible 

Source
pub trait Interruptible {
    // Required method
    fn pid(&mut self) -> Result<Option<u32>>;

    // Provided method
    fn interrupt(&mut self) -> Result<()> { ... }
}
Expand description

A trait for sending interrupts/ctrl-c to child processes.

NOTE: By implementing this trait, you are stating that the correct steps have been taken to ensure that the child process can actually be interrupted.

Required Methods§

Source

fn pid(&mut self) -> Result<Option<u32>>

Get the pid of the child process. It returns Ok(Some(u32)) if the process is running and the PID is available. It returns Ok(None) if the process is already known to be completed. An error is returned if one occurs while attempting to get the pid.

Provided Methods§

Source

fn interrupt(&mut self) -> Result<()>

Send a ctrl-c interrupt to the child process. It returns an error if the process is already known to be completed.

Implementors§

Source§

impl Interruptible for send_ctrlc::InterruptibleChild

Source§

impl Interruptible for send_ctrlc::tokio::InterruptibleChild

Available on crate feature tokio only.