diff --git a/implants/lib/eldritch/Cargo.toml b/implants/lib/eldritch/Cargo.toml index 8c9ed5d09..75c198a8c 100644 --- a/implants/lib/eldritch/Cargo.toml +++ b/implants/lib/eldritch/Cargo.toml @@ -93,6 +93,7 @@ listeners = { workspace = true } transport = { workspace = true, features = ["mock"] } httptest = { workspace = true } uuid = { workspace = true, features = ["v4"] } +lazy_static = "1.5.0" # BUILD [build-dependencies] diff --git a/implants/lib/eldritch/src/sys/exec_impl.rs b/implants/lib/eldritch/src/sys/exec_impl.rs index ec65a012b..0cd45c943 100644 --- a/implants/lib/eldritch/src/sys/exec_impl.rs +++ b/implants/lib/eldritch/src/sys/exec_impl.rs @@ -121,9 +121,16 @@ fn handle_exec( mod tests { use std::{fs, path::Path, process, thread, time}; + use lazy_static::lazy_static; + use std::sync::Mutex; use sysinfo::{PidExt, ProcessExt, System, SystemExt}; use tempfile::NamedTempFile; + lazy_static! { + // Mutex to serialize tests that check for zombie processes to prevent interference + static ref ZOMBIE_TEST_MUTEX: Mutex<()> = Mutex::new(()); + } + fn init_logging() { let _ = pretty_env_logger::formatted_timed_builder() .filter_level(log::LevelFilter::Info) @@ -239,6 +246,9 @@ mod tests { #[test] fn test_sys_exec_disown_linux() -> anyhow::Result<()> { + // Acquire mutex to ensure exclusive access to process table/zombie checks + let _guard = ZOMBIE_TEST_MUTEX.lock().unwrap(); + if cfg!(target_os = "linux") || cfg!(target_os = "ios") || cfg!(target_os = "macos") @@ -269,6 +279,9 @@ mod tests { #[test] fn test_sys_exec_disown_no_defunct() -> anyhow::Result<()> { + // Acquire mutex to ensure exclusive access to process table/zombie checks + let _guard = ZOMBIE_TEST_MUTEX.lock().unwrap(); + init_logging(); if cfg!(target_os = "linux") diff --git a/test_output.log b/test_output.log new file mode 100644 index 000000000..0bd1eb785 --- /dev/null +++ b/test_output.log @@ -0,0 +1,8 @@ +npm error code ENOENT +npm error syscall open +npm error path /app/package.json +npm error errno -2 +npm error enoent Could not read package.json: Error: ENOENT: no such file or directory, open '/app/package.json' +npm error enoent This is related to npm not being able to find a file. +npm error enoent +npm error A complete log of this run can be found in: /home/jules/.npm/_logs/2026-01-06T08_28_56_438Z-debug-0.log