Skip to content

Commit

Permalink
Close the lock file in pexes when we're doing (#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
peterebden authored Dec 13, 2024
1 parent 2ab13c9 commit 397ea0c
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions tools/please_pex/pex/pex_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ def explode_zip():
def pex_lockfile(basepath, uniquedir):
# Acquire the lockfile.
lockfile_path = os.path.join(basepath, '.lock-%s' % uniquedir)
lockfile = open(lockfile_path, "a+")
# Block until we can acquire the lockfile.
portalocker.lock(lockfile, portalocker.LOCK_EX)
lockfile.seek(0)
yield lockfile
portalocker.lock(lockfile, portalocker.LOCK_UN)
with open(lockfile_path, "a+") as lockfile:
# Block until we can acquire the lockfile.
portalocker.lock(lockfile, portalocker.LOCK_EX)
lockfile.seek(0)
yield lockfile
portalocker.lock(lockfile, portalocker.LOCK_UN)

@contextlib.contextmanager
def _explode_zip():
Expand Down

0 comments on commit 397ea0c

Please sign in to comment.