diff --git a/tests/exec.rs b/tests/exec.rs index cba4c8e..2b47b77 100644 --- a/tests/exec.rs +++ b/tests/exec.rs @@ -1,4 +1,5 @@ use std::fs; +use std::path::PathBuf; use std::process::Command; use birdcage::{Birdcage, Exception, Sandbox}; @@ -7,8 +8,12 @@ fn main() { let mut birdcage = Birdcage::new().unwrap(); birdcage.add_exception(Exception::ExecuteAndRead("/usr/bin/true".into())).unwrap(); birdcage.add_exception(Exception::ExecuteAndRead("/usr/lib".into())).unwrap(); - birdcage.add_exception(Exception::ExecuteAndRead("/lib64".into())).unwrap(); - birdcage.add_exception(Exception::ExecuteAndRead("/lib".into())).unwrap(); + if PathBuf::from("/lib64").exists() { + birdcage.add_exception(Exception::ExecuteAndRead("/lib64".into())).unwrap(); + } + if PathBuf::from("/lib64").exists() { + birdcage.add_exception(Exception::ExecuteAndRead("/lib".into())).unwrap(); + } birdcage.lock().unwrap(); // Check for success when executing `true`.