avahi.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:maas 作者: maas 项目源码 文件源码
def _terminate_process(process, wait=2.5, kill=2.5):
    """Ensures that `process` terminates.

    :return: The exit code of the process.
    """
    try:
        # The subprocess may have already been signalled, for example as part
        # of this process's process group when Ctrl-c is pressed at the
        # terminal, so give it some time to exit.
        return process.wait(timeout=wait)
    except subprocess.TimeoutExpired:
        # Either the subprocess has not been signalled, or it's slow.
        process.terminate()  # SIGTERM.
        try:
            return process.wait(timeout=kill)
        except subprocess.TimeoutExpired:
            process.kill()  # SIGKILL.
            return process.wait()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号