procfs is linux only

This commit is contained in:
Robin Appelman 2024-04-08 22:37:36 +02:00
commit fdb7c3c374
2 changed files with 4 additions and 0 deletions

View file

@ -26,6 +26,8 @@ if-addrs = "0.12.0"
sysconf = "0.3.4" sysconf = "0.3.4"
thiserror = "1.0.58" thiserror = "1.0.58"
clap = { version = "=4.4.18", features = ["derive"] } clap = { version = "=4.4.18", features = ["derive"] }
[target.'cfg(not(windows))'.dependencies]
procfs = "0.16.0" procfs = "0.16.0"
[target.'cfg(windows)'.dependencies] [target.'cfg(windows)'.dependencies]

View file

@ -1,3 +1,4 @@
#[cfg(not(target_os = "windows"))]
use procfs::ProcError; use procfs::ProcError;
use std::ffi::NulError; use std::ffi::NulError;
use std::fmt::Write; use std::fmt::Write;
@ -36,6 +37,7 @@ pub enum Error {
InvalidStringData(#[from] Utf8Error), InvalidStringData(#[from] Utf8Error),
#[error(transparent)] #[error(transparent)]
InvalidCStringData(#[from] NulError), InvalidCStringData(#[from] NulError),
#[cfg(not(target_os = "windows"))]
#[error(transparent)] #[error(transparent)]
Proc(#[from] ProcError), Proc(#[from] ProcError),
#[error("Failed to query vfs stats")] #[error("Failed to query vfs stats")]