From 0fe3c3fe877ccf948b8fe1b4eaa1a34de6d84882 Mon Sep 17 00:00:00 2001 From: kpcyrd Date: Thu, 14 Jan 2021 11:49:41 +0100 Subject: [PATCH] Only try to bump ulimit on Linux due to MacOS issues See #78 --- Cargo.toml | 2 ++ src/lib.rs | 2 +- src/main.rs | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index af5e76e..d4ecd19 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,4 +50,6 @@ dirs-next = "2.0" [target."cfg(unix)".dependencies] termios = "0.3" + +[target.'cfg(target_os="linux")'.dependencies] rlimit = "0.5" diff --git a/src/lib.rs b/src/lib.rs index 5a1c0f0..92b528f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,6 +17,6 @@ pub mod runtime; pub mod scheduler; pub mod sockets; pub mod structs; -#[cfg(unix)] +#[cfg(target_os="linux")] pub mod ulimit; pub mod utils; diff --git a/src/main.rs b/src/main.rs index 5c8bf3a..0fd4b06 100644 --- a/src/main.rs +++ b/src/main.rs @@ -171,7 +171,7 @@ fn main() -> Result<()> { } let config = Arc::new(Config::load()?); - #[cfg(unix)] + #[cfg(target_os="linux")] badtouch::ulimit::set_nofile(&config) .context("Failed to set RLIMIT_NOFILE")?;