Trait signal_child::Signalable
source · [−]pub trait Signalable {
fn signal(&mut self, signal: Signal) -> Result<()>;
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");