lockfile.py 文件源码

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

项目:user-sync.py 作者: adobe-apiplatform 项目源码 文件源码
def is_locked(self):
        # process is not locked if lock file does not exist
        if not os.path.exists(self.path):
            return False

        # if lock file exists, get pid
        with open(self.path, 'r') as f:
            lock_pid = f.read().strip()

        if not lock_pid:
            return False

        lock_pid = int(lock_pid)

        if psutil.pid_exists(lock_pid):
            return True
        else:
            return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号