diff --git a/src/process.rs b/src/process.rs index 8e184bbe..39004ae4 100644 --- a/src/process.rs +++ b/src/process.rs @@ -8,13 +8,20 @@ use std::os::unix::process::ExitStatusExt; use std::os::windows::process::ExitStatusExt; use std::{num::NonZeroU32, os::raw::c_int, process::ExitStatus, ptr::null}; -use rb_sys::{pid_t, rb_sys_fail, rb_waitpid}; +use rb_sys::{rb_sys_fail, rb_waitpid}; use crate::{ api::Ruby, error::{protect, Error}, }; +#[allow(non_camel_case_types)] +#[cfg(unix)] +type rb_pid_t = c_int; +#[allow(non_camel_case_types)] +#[cfg(windows)] +type rb_pid_t = i64; + /// # Process /// /// Functions for working with processes. @@ -98,12 +105,12 @@ pub enum WaitTarget { } impl WaitTarget { - fn to_rb_pid_t(self) -> pid_t { + fn to_rb_pid_t(self) -> rb_pid_t { match self { - Self::ChildPid(pid) => pid as pid_t, + Self::ChildPid(pid) => pid as rb_pid_t, Self::ProcessGroup => 0, Self::AnyChild => -1, - Self::ChildProcessGroup(pid) => -(pid as pid_t), + Self::ChildProcessGroup(pid) => -(pid as rb_pid_t), } } }