def kill(pid, signum=signal.SIGKILL):
"""
Safe version of `os.kill(pid, signum)` that catches OSError in case of an
already-dead pid.
"""
try:
os.kill(pid, signum)
except OSError as e:
if e.errno != errno.ESRCH:
# Allow "No such process", since that means process is
# already gone---no need to kill what's already dead
raise
评论列表
文章目录