From dd8cbdbe2738a56e5dff34162057c4e58a36674f Mon Sep 17 00:00:00 2001 From: Mats Wichmann Date: Tue, 5 Sep 2023 16:04:47 -0600 Subject: filellock: also recognize PermissionError Saw an instance where acquiring the lock didn't spin because the lockfile access gave PermissionError instead of FileExistsError. Rather than trying to sort that out, just accept both. Signed-off-by: Mats Wichmann --- SCons/Util/filelock.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SCons/Util/filelock.py b/SCons/Util/filelock.py index 7e915af..4b825a6 100644 --- a/SCons/Util/filelock.py +++ b/SCons/Util/filelock.py @@ -58,7 +58,7 @@ class FileLock: or some arbitrary number? Arguments: - file: name of file to lock. + file: name of file to lock. Only used to build the lockfile name. timeout: optional time (sec) to give up trying. If ``None``, quit now if we failed to get the lock (non-blocking). If 0, block forever (well, a long time). @@ -104,7 +104,7 @@ class FileLock: while True: try: self.lock = os.open(self.lockfile, os.O_CREAT|os.O_EXCL|os.O_RDWR) - except FileExistsError as exc: + except (FileExistsError, PermissionError) as exc: if self.timeout is None: raise SConsLockFailure( f"Could not acquire lock on {self.file!r}" -- cgit v0.12