We don't need an exclusive lock to make this copy, so let's take only
a shared lock.
sandbox=config.sandbox,
)
- with flock(src):
+ with flock(src, flags=fcntl.LOCK_SH):
fork_and_wait(copy)
yield tmp
finally:
@contextlib.contextmanager
-def flock_or_die(path: Path) -> Iterator[Path]:
+def flock_or_die(path: Path, flags: int = fcntl.LOCK_EX) -> Iterator[Path]:
try:
- with flock(path, fcntl.LOCK_EX | fcntl.LOCK_NB):
+ with flock(path, flags | fcntl.LOCK_NB):
yield path
except OSError as e:
if e.errno != errno.EWOULDBLOCK: