Function kill
pub unsafe fn kill(pid: i32, signal: i32) -> Result<(), i32> ⓘ
Available on crate feature
dep_nc
only.Expand description
Send signal to a process.
§Examples
let pid = unsafe { nc::fork() };
assert!(pid.is_ok());
let pid = pid.unwrap();
assert!(pid >= 0);
if pid == 0 {
// child process.
let args = [""];
let env = [""];
let ret = unsafe { nc::execve("/usr/bin/yes", &args, &env) };
assert!(ret.is_ok());
} else {
// parent process.
let ret = unsafe { nc::kill(pid, nc::SIGTERM) };
assert!(ret.is_ok());
}