From f0335dc7dd249c236c1acc1a69a2471357c5b836 Mon Sep 17 00:00:00 2001 From: Eisuke Kawashima Date: Fri, 17 Feb 2023 03:22:23 +0900 Subject: 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. --- mesonbuild/utils/posix.py | 3 +++ 1 file changed, 3 insertions(+) (limited to 'mesonbuild') 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) -- cgit v1.1