aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEisuke Kawashima <e-kwsm@users.noreply.github.com>2023-02-17 03:22:23 +0900
committerNirbheek Chauhan <nirbheek@centricular.com>2023-02-21 03:04:33 +0530
commit9b2d36cd90239cea771f49f7723a85422385277b (patch)
tree1b925f4d474e13d5c5b509e6a5155a8e3a252a3b
parentaca2a9396146064275d7fcbeebd59402e03c17b7 (diff)
downloadmeson-9b2d36cd90239cea771f49f7723a85422385277b.zip
meson-9b2d36cd90239cea771f49f7723a85422385277b.tar.gz
meson-9b2d36cd90239cea771f49f7723a85422385277b.tar.bz2
handle more corner cases where locking the build directory fails
This can raise any OSError, but we only caught two of them that indicate a particular failure case. Also catch the generic error form with a more generic message. This produces better error messages in cases where e.g. exclusive lock is not supported.
-rw-r--r--mesonbuild/utils/posix.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/mesonbuild/utils/posix.py b/mesonbuild/utils/posix.py
index 161e8fc..51c3cd0 100644
--- a/mesonbuild/utils/posix.py
+++ b/mesonbuild/utils/posix.py
@@ -34,6 +34,9 @@ class BuildDirLock(BuildDirLockBase):
except (BlockingIOError, PermissionError):
self.lockfile.close()
raise MesonException('Some other Meson process is already using this build directory. Exiting.')
+ except OSError as e:
+ self.lockfile.close()
+ raise MesonException(f'Failed to lock the build directory: {e.strerror}')
def __exit__(self, *args: T.Any) -> None:
fcntl.flock(self.lockfile, fcntl.LOCK_UN)