not killing when pid is not assigned

This commit is contained in:
mantaohuang 2020-08-02 00:54:24 -04:00
parent d8c794fa56
commit 710811d641

View File

@ -104,10 +104,11 @@ class ProcessManager:
return return
self.state = ProcessManagerState.IDLE self.state = ProcessManagerState.IDLE
self.task.cancel() self.task.cancel()
try: if self.pid:
os.kill(self.pid, signal.SIGINT) try:
except Exception as err: os.kill(self.pid, signal.SIGINT)
logging.warning(f"kill failed: {err}") except Exception as err:
logging.warning(f"kill failed: {err}")
self.task.cancel() self.task.cancel()
self.pid = 0 self.pid = 0