2020-01-05 11:56:18 -05:00
|
|
|
use deno_core::ErrBox;
|
2019-04-21 21:26:56 -04:00
|
|
|
|
|
|
|
#[cfg(unix)]
|
2019-07-10 18:53:48 -04:00
|
|
|
pub fn kill(pid: i32, signo: i32) -> Result<(), ErrBox> {
|
|
|
|
use nix::sys::signal::{kill as unix_kill, Signal};
|
|
|
|
use nix::unistd::Pid;
|
2019-04-21 21:26:56 -04:00
|
|
|
let sig = Signal::from_c_int(signo)?;
|
2019-07-10 18:53:48 -04:00
|
|
|
unix_kill(Pid::from_raw(pid), Option::Some(sig)).map_err(ErrBox::from)
|
2019-04-21 21:26:56 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
#[cfg(not(unix))]
|
2019-07-10 18:53:48 -04:00
|
|
|
pub fn kill(_pid: i32, _signal: i32) -> Result<(), ErrBox> {
|
2019-04-21 21:26:56 -04:00
|
|
|
// NOOP
|
|
|
|
// TODO: implement this for windows
|
|
|
|
Ok(())
|
|
|
|
}
|