def terminate(self):
for child in self.__children:
child.terminate()
self.__children = []
for sig, timeout in self.STOP_SIGNALS:
try:
log.debug('Killing process group %s with signal %s', self.__process.pid, sig)
os.killpg(self.__process.pid, sig)
except OSError:
pass
giveup_time = time.time() + timeout
while self.__process.poll() is None:
if time.time() > giveup_time:
break
time.sleep(0.1)
if self.__process.poll() is not None:
break
self.__process.wait()
self.__process = None
评论列表
文章目录