예제 #1
0
    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
예제 #2
0
    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
예제 #3
0
파일: proc.py 프로젝트: CivilPol/chaperone
 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 '?'
예제 #4
0
 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 '?'