pub trait ChildExt: Sealed {
// Required method
fn send_signal(&self, signal: i32) -> Result<()>;
}
unix_send_signal #141975)
fn send_signal(&self, signal: i32) -> Result<()>
unix_send_signal #141975)
Sends a signal to a child process.
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.
#![feature(unix_send_signal)]
use std::{io, os::unix::process::ChildExt, process::{Command, Stdio}};
use libc::SIGTERM;
fn main() -> io::Result<()> {
let child = Command::new("cat").stdin(Stdio::piped()).spawn()?;
child.send_signal(SIGTERM)?;
Ok(())
}impl ChildExt for Child
© 2010 The Rust Project Developers
Licensed under the Apache License, Version 2.0 or the MIT license, at your option.
https://doc.rust-lang.org/std/os/unix/process/trait.ChildExt.html