def notify_ERRNO(self, value): try: intval = int(value) except ValueError: self.logdebug("{0} got ERROR={1}, not a valid error code", self.name, value) return code = ProcStatus(intval << 8) if not self._setready(): self.process_exit(code) else: self.returncode = code
def _do_waitpid_all(self): # Because of signal coalescing, we must keep calling waitpid() as # long as we're able to reap a child. while True: try: pid, status = os.waitpid(-1, os.WNOHANG) debug("REAP pid={0},status={1}".format(pid, status)) except ChildProcessError: # No more child processes exist. if self._had_children: debug("no child processes present") self.events.onNoProcesses() return else: self._had_children = True if pid == 0: # A child process is still alive. return returncode = ProcStatus(status) with self._lock: try: callback, args = self._callbacks.pop(pid) except KeyError: # unknown child if self._forks: # It may not be registered yet. self._zombies[pid] = returncode continue callback = None if callback is None: info( "Caught subprocess termination from unknown pid: " "%d -> %d", pid, returncode) else: callback(pid, returncode, *args)
def notify_BUSERROR(self, value): code = ProcStatus(value) if not self._setready(): self.process_exit(code) else: self.returncode = code
def returncode(self, val): self._returncode = ProcStatus(val) self.logdebug("{0} got explicit return code '{1}'", self.name, self._returncode)