do { $r = waitpid($pid, WNOHANG); } while $r<0 and ($! == Errno::EINTR or $! == Errno::ERESTART); last if $r;