Skip to content

Commit

Permalink
handle more corner cases where locking the build directory fails
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
e-kwsm authored and Eli Schwartz committed Feb 19, 2023
1 parent 019fda9 commit f0335dc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions mesonbuild/utils/posix.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ def __enter__(self) -> None:
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)
Expand Down

0 comments on commit f0335dc

Please sign in to comment.