Skip to content

Commit

Permalink
fix windows more
Browse files Browse the repository at this point in the history
  • Loading branch information
matsadler committed Oct 8, 2023
1 parent 55dd269 commit 91e4e99
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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),
}
}
}
Expand Down

0 comments on commit 91e4e99

Please sign in to comment.