def terminate(self): proc = self._proc otherpid = self.pid if proc: if otherpid == proc.pid: otherpid = None if proc.returncode is None: if self.service.kill_signal is not None: # explicitly check service self.logdebug("using {0} to terminate {1}", get_signal_name(self.kill_signal), self.name) proc.send_signal(self.kill_signal) else: proc.terminate() if otherpid: self.logdebug("using {0} to terminate {1}", get_signal_name(self.kill_signal), self.name) try: os.kill(otherpid, self.kill_signal) except Exception as ex: warn("{0} could not be killed using PID={1}: ".format( ex, otherpid)) self._pid = None
def terminate(self): proc = self._proc otherpid = self.pid if proc: if otherpid == proc.pid: otherpid = None if proc.returncode is None: if self.service.kill_signal is not None: # explicitly check service self.logdebug("using {0} to terminate {1}", get_signal_name(self.kill_signal), self.name) proc.send_signal(self.kill_signal) else: proc.terminate() if otherpid: self.logdebug("using {0} to terminate {1}", get_signal_name(self.kill_signal), self.name) try: os.kill(otherpid, self.kill_signal) except Exception as ex: warn("{0} could not be killed using PID={1}: ".format(ex, otherpid)) self._pid = None
def briefly(self): if self.signaled or self.stopped: return get_signal_name(self.signal) if self.exited: return "exit({0})".format(self.exit_status) return '?'