Trait Signalable

Source
pub trait Signalable {
    // Required method
    fn signal(&mut self, signal: Signal) -> Result<()>;

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

Trait for things that can be signaled, mainly Child.

§Example

use std::process::Command;
use signal_child::{Signalable, signal};

// Spawn child process
let mut child = Command::new("sleep")
    .arg("1000")
    .spawn()
    .expect("Error spawning sleep process");
// Send SIGUSR1 to the child.
child.signal(signal::SIGUSR1).expect("Error signaling child");

Required Methods§

Source

fn signal(&mut self, signal: Signal) -> Result<()>

Signal the thing

Provided Methods§

Source

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

Send SIGTERM

Source

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

Send SIGINT

Source

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

Send SIGHUP

Implementations on Foreign Types§

Source§

impl Signalable for Child

Source§

fn signal(&mut self, signal: Signal) -> Result<()>

Implementors§