diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 32291fc..28b3d0b 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -20,7 +20,7 @@ jobs: - uses: actions/checkout@v7 - uses: dtolnay/rust-toolchain@stable - name: Run tests - run: cargo test + run: cargo test --verbose -- --nocapture build: runs-on: ${{ matrix.os }} strategy: diff --git a/Cargo.toml b/Cargo.toml index 7ebbb07..fb3cee1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,5 +23,5 @@ procfs = "0.18" libc = "0.2" [target.'cfg(target_os = "macos")'.dependencies] -darwin-libproc = "0.2" +libproc = "0.14" libc = "0.2" diff --git a/src/lib.rs b/src/lib.rs index 21272a3..2347626 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -79,6 +79,6 @@ pub enum Error { FileContentsMalformed, /// A system-native function returned an error code. - #[error("Call to system-native API errored: {0}")] + #[error("Call to system-native API failed: {0}")] SystemCall(std::io::Error), } diff --git a/src/macos.rs b/src/macos.rs index a70de56..deb9bc1 100644 --- a/src/macos.rs +++ b/src/macos.rs @@ -1,9 +1,13 @@ use crate::{Error, ProcessStats}; +use libproc::proc_pid::pidinfo; +use libproc::task_info::TaskInfo; use std::time::Duration; pub fn get_info() -> Result { let pid = unsafe { libc::getpid() }; - let proc_info = darwin_libproc::task_info(pid).map_err(Error::SystemCall)?; + let proc_info = pidinfo::(pid as i32, 0) + .map_err(std::io::Error::other) + .map_err(Error::SystemCall)?; let timebase_info = mach_timebase_info::get(); Ok(ProcessStats {