Function unshare::reap_zombies [] [src]

pub fn reap_zombies() -> ZombieIterator

Creates iterator over zombie processes

On each iteration it calls waitpid() and returns child pid and exit status if there is zombie process. The operation is non-blocking. The iterator is exhausted when there are no zombie process at the moment,

So waiting for all processes to finish may look like this: while alive.len() > 0 { sigwait() for (pid, status) in zombies() { alive. remove(pid); } }

Note if you are using this function you can't reliably use Child::wait any more.