warning: in the working copy of 'crates/spt/tests/worker_lifecycle_e2e.rs', LF will be replaced by CRLF the next time Git touches it warning: in the working copy of 'crates/spt/tests/worker_lifecycle_e2e.rs', LF will be replaced by CRLF the next time Git touches it diff --git a/crates/spt/tests/worker_lifecycle_e2e.rs b/crates/spt/tests/worker_lifecycle_e2e.rs index 0c7bb96..4ba6fc0 100644 --- a/crates/spt/tests/worker_lifecycle_e2e.rs +++ b/crates/spt/tests/worker_lifecycle_e2e.rs @@ -77,9 +77,20 @@ fn reap_daemon(home: &std::path::Path, owned_target: &std::path::Path) { !ancestors.contains(&pid), "WORKER_E2E_REAP_REFUSED: target pid {pid} is a test-harness ancestor: {ancestors:?}" ); - let exe = spt_store::proc::exe_path(pid).unwrap_or_else(|| { - panic!("WORKER_E2E_REAP_REFUSED: cannot resolve executable for pid {pid}") - }); + if !spt_store::proc::is_process_alive(pid) { + eprintln!("WORKER_E2E_REAP_SKIPPED: pid {pid} already exited"); + return; + } + let exe = match spt_store::proc::exe_path(pid) { + Some(exe) => exe, + None if !spt_store::proc::is_process_alive(pid) => { + eprintln!("WORKER_E2E_REAP_SKIPPED: pid {pid} already exited"); + return; + } + None => { + panic!("WORKER_E2E_REAP_REFUSED: live pid {pid} executable is unreadable") + } + }; assert!( exe.starts_with(owned_target), "WORKER_E2E_REAP_REFUSED: pid {pid} resolves outside owned target: exe={} target={}",