aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEisuke Kawashima <e-kwsm@users.noreply.github.com>2023-02-17 03:22:23 +0900
committerEli Schwartz <eschwartz@archlinux.org>2023-02-19 12:28:33 -0500
commitf0335dc7dd249c236c1acc1a69a2471357c5b836 (patch)
tree61e2ef5b90a6d23e10bdc10291624404182715ef
parent019fda91d0cb4308803c32e8d9dd311b85caf702 (diff)
downloadmeson-f0335dc7dd249c236c1acc1a69a2471357c5b836.zip
meson-f0335dc7dd249c236c1acc1a69a2471357c5b836.tar.gz
meson-f0335dc7dd249c236c1acc1a69a2471357c5b836.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)