def __enter__(self):
"""Enter RunSingleInstance class
:return: self
"""
self.__checked = True
try:
self.__filelock = open(self.__lockfile, 'w+')
# None blocking lock
fcntl.lockf(self.__filelock, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError:
if self.__filelock is not None:
self.__is_running = True
return self
评论列表
文章目录