mirror of
https://github.com/denoland/deno.git
synced 2024-10-31 09:14:20 -04:00
17 lines
528 B
Rust
17 lines
528 B
Rust
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
|
|
use crate::op_error::OpError;
|
|
|
|
#[cfg(unix)]
|
|
pub fn kill(pid: i32, signo: i32) -> Result<(), OpError> {
|
|
use nix::sys::signal::{kill as unix_kill, Signal};
|
|
use nix::unistd::Pid;
|
|
use std::convert::TryFrom;
|
|
let sig = Signal::try_from(signo)?;
|
|
unix_kill(Pid::from_raw(pid), Option::Some(sig)).map_err(OpError::from)
|
|
}
|
|
|
|
#[cfg(not(unix))]
|
|
pub fn kill(_pid: i32, _signal: i32) -> Result<(), OpError> {
|
|
// TODO: implement this for windows
|
|
Ok(())
|
|
}
|