2019-04-21 21:26:56 -04:00
|
|
|
#[cfg(unix)]
|
|
|
|
use nix::sys::signal::{kill as unix_kill, Signal};
|
|
|
|
#[cfg(unix)]
|
|
|
|
use nix::unistd::Pid;
|
|
|
|
|
2019-06-19 22:07:01 -04:00
|
|
|
use crate::deno_error::DenoResult;
|
2019-04-21 21:26:56 -04:00
|
|
|
|
|
|
|
#[cfg(unix)]
|
|
|
|
pub fn kill(pid: i32, signo: i32) -> DenoResult<()> {
|
2019-06-19 22:07:01 -04:00
|
|
|
use crate::deno_error::DenoError;
|
2019-04-21 21:26:56 -04:00
|
|
|
let sig = Signal::from_c_int(signo)?;
|
|
|
|
unix_kill(Pid::from_raw(pid), Option::Some(sig)).map_err(DenoError::from)
|
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(not(unix))]
|
|
|
|
pub fn kill(_pid: i32, _signal: i32) -> DenoResult<()> {
|
|
|
|
// NOOP
|
|
|
|
// TODO: implement this for windows
|
|
|
|
Ok(())
|
|
|
|
}
|