aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbnewbold <bnewbold@robocracy.org>2016-10-12 22:58:46 -0700
committerbnewbold <bnewbold@robocracy.org>2016-10-12 22:58:46 -0700
commitabda19fd5361ec0b8fa38f1f98855112c0a37bd8 (patch)
treeff6a959e1c4eaa81456cf770ee690665e00fae40 /src
parentc3725511aba85f2422b09b5aa1aacf2b89aa7b77 (diff)
downloadeinhyrningsins-abda19fd5361ec0b8fa38f1f98855112c0a37bd8.tar.gz
einhyrningsins-abda19fd5361ec0b8fa38f1f98855112c0a37bd8.zip
clean up more robustly (child reaping)
Diffstat (limited to 'src')
-rw-r--r--src/main.rs6
1 files 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<Signal>) {
}
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.");
}