Skip to content

Commit 9b2d36c

Browse files
e-kwsmnirbheek
authored andcommitted
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.
1 parent aca2a93 commit 9b2d36c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

mesonbuild/utils/posix.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ def __enter__(self) -> None:
3434
except (BlockingIOError, PermissionError):
3535
self.lockfile.close()
3636
raise MesonException('Some other Meson process is already using this build directory. Exiting.')
37+
except OSError as e:
38+
self.lockfile.close()
39+
raise MesonException(f'Failed to lock the build directory: {e.strerror}')
3740

3841
def __exit__(self, *args: T.Any) -> None:
3942
fcntl.flock(self.lockfile, fcntl.LOCK_UN)

0 commit comments

Comments
 (0)