def kill_last_pid():
"""Kill the last pid. See:
https://github.com/google/clusterfuzz-tools/issues/299"""
# We have found that, when invoking `sv stop python-daemon`, the process
# in call() isn't killed. Therefore, we need to explicitly kill it and
# all of its children.
#
# We hope that pid recycling is not that fast.
try:
with open(LAST_PID_FILE, 'r') as f:
pid = int(f.read().strip())
os.killpg(pid, signal.SIGKILL)
except: # pylint: disable=bare-except
pass
finally:
try:
os.remove(LAST_PID_FILE)
except: # pylint: disable=bare-except
pass
评论列表
文章目录