diff options
author | Eisuke Kawashima <e-kwsm@users.noreply.github.com> | 2023-02-17 03:22:23 +0900 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2023-02-21 03:04:33 +0530 |
commit | 9b2d36cd90239cea771f49f7723a85422385277b (patch) | |
tree | 1b925f4d474e13d5c5b509e6a5155a8e3a252a3b | |
parent | aca2a9396146064275d7fcbeebd59402e03c17b7 (diff) | |
download | meson-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.py | 3 |
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) |