def _try_lock(self, fd):
"""Try to acquire the lock file without blocking.
:param int fd: file descriptor of the opened file to lock
"""
try:
fcntl.lockf(fd, fcntl.LOCK_EX | fcntl.LOCK_NB)
except IOError as err:
if err.errno in (errno.EACCES, errno.EAGAIN):
logger.debug(
"A lock on %s is held by another process.", self._path)
raise errors.LockError(
"Another instance of Certbot is already running.")
raise
评论列表
文章目录