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.
pull/11406/head
Eisuke Kawashima 2 years ago committed by Eli Schwartz
parent 019fda91d0
commit f0335dc7dd
No known key found for this signature in database
GPG Key ID: CEB167EFB5722BD6
  1. 3
      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)

Loading…
Cancel
Save