From abda19fd5361ec0b8fa38f1f98855112c0a37bd8 Mon Sep 17 00:00:00 2001 From: bnewbold Date: Wed, 12 Oct 2016 22:58:46 -0700 Subject: clean up more robustly (child reaping) --- src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index e7f4fe5..7074d38 100644 --- a/src/main.rs +++ b/src/main.rs @@ -424,8 +424,10 @@ fn shepard(mut state: EinState, signal_rx: Receiver) { } println!("Reaping children... (count={})", brood.len()); - for (_, o) in brood.iter_mut() { - o.process.wait().ok(); + for (pid, o) in brood.iter() { + if o.is_active() { + nix::sys::wait::waitpid(*pid as i32, Some(nix::sys::wait::WNOHANG)).ok(); + } } println!("Done."); } -- cgit v1.2.3