daemon.py 文件源码

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

项目:aquests 作者: hansroh 项目源码 文件源码
def kill (chdir, procname = None, include_children = True, signaling = True):
    import psutil

    for i in range (2):
        pid = status (chdir, procname)      
        if not pid: 
            break

        if signaling:   
            os.kill (pid, signal.SIGTERM)
            time.sleep (2)

        if include_children:
            try:
                killtree.kill (pid, True)
            except psutil.NoSuchProcess:
                pass    

        while processutil.is_running (pid, procname):
            time.sleep (1)

    try:
        os.remove (os.path.join (chdir, ".pid"))
    except FileNotFoundError:   
        pass
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号