This code: def _watch_mock(self, good_exit, bad_exit): (aux_pid, status) = os.waitpid(self._childpid, os.WNOHANG) status = os.WEXITSTATUS(status) if aux_pid: self._log("_watch_mock(): PID %d exit status %d\n" % (self._childpid, status)) self._childpid = 0 if status == 0: self._done_status = good_exit self._log("Setting Status Good! - %s\n" % self._done_status) elif status > 0: self._done_status = bad_exit self._log("Setting Status Bad! - %s\n" % self._done_status) self._copy_mock_output_to_log() self._start_cleanup() Produced this output: _watch_mock(): PID 24626 exit status 0 Setting Status Good! - failed