Trait ChildExt

trait ChildExt: Sealed

Required Methods

fn send_signal(self: &Self, signal: i32) -> io::Result<()>

Sends a signal to a child process.

Errors

This function will return an error if the signal is invalid. The integer values associated with signals are implementation-specific, so it's encouraged to use a crate that provides posix bindings.

Examples

#![feature(unix_send_signal)]

use std::{io, os::unix::process::ChildExt, process::{Command, Stdio}};

use libc::SIGTERM;

fn main() -> io::Result<()> {
    # if cfg!(not(all(target_vendor = "apple", not(target_os = "macos")))) {
    let child = Command::new("cat").stdin(Stdio::piped()).spawn()?;
    child.send_signal(SIGTERM)?;
    # }
    Ok(())
}

Implementors