pub trait UnixChildExt {
    // Required method
    fn signal(&self, sig: Signal) -> Result<()>;
}
Expand description

Unix-specific extensions to process Children.

Required Methods§

source

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

Sends a signal to the child process. If the process has already exited, an InvalidInput error is returned.

Examples

Basic usage:

use std::process::Command;
use command_group::{UnixChildExt, Signal};

let mut command = Command::new("yes");
if let Ok(mut child) = command.spawn() {
    child.signal(Signal::SIGTERM).expect("command wasn't running");
} else {
    println!("yes command didn't start");
}

With a process group:

use std::process::Command;
use command_group::{CommandGroup, UnixChildExt, Signal};

let mut command = Command::new("yes");
if let Ok(mut child) = command.group_spawn() {
    child.signal(Signal::SIGTERM).expect("command wasn't running");
} else {
    println!("yes command didn't start");
}

Implementations on Foreign Types§

source§

impl UnixChildExt for Child

source§

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

source§

impl UnixChildExt for Child

source§

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

Implementors§