Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion plain-code/plain/code/oxc.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,16 @@ def download(self, version: str = "") -> str:
dst.write(extracted.read())

os.chmod(tmp_path, 0o755)
os.replace(tmp_path, binary_path)
try:
os.replace(tmp_path, binary_path)
except PermissionError:
# Windows raises this if another process has binary_path open
# (e.g. another checkout sharing this machine-wide cache is
# currently running it). If it's already there, another
# process finished installing this exact version — nothing
# left to do.
if not binary_path.exists():
raise
finally:
tmp_path.unlink(missing_ok=True)

Expand Down
11 changes: 10 additions & 1 deletion plain-tailwind/plain/tailwind/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,16 @@ def download(self, version: str = "") -> str:

binary_path = self.binary_path(version)
binary_path.parent.mkdir(parents=True, exist_ok=True)
os.replace(tmp_path, binary_path)
try:
os.replace(tmp_path, binary_path)
except PermissionError:
# Windows raises this if another process has binary_path open
# (e.g. `plain tailwind build --watch` in a different checkout
# sharing this machine-wide cache). If it's already there,
# another process finished installing this exact version —
# nothing left to do.
if not binary_path.exists():
raise
finally:
tmp_path.unlink(missing_ok=True)

Expand Down
Loading