if (waitpid($child_pid, WNOHANG) > 0) { ... the child just died ... }