Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle safe_copy failing to hardlink on Windows due to too many existing links #2394

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion pex/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ def do_copy():
os.rename(temp_dest, dest)

# If the platform supports hard-linking, use that and fall back to copying.
# Windows does not support hard-linking.
if hasattr(os, "link"):
try:
os.link(source, dest)
Expand All @@ -127,6 +126,10 @@ def do_copy():
#
# See also https://github.com/pex-tool/pex/issues/850 where this was discovered.
do_copy()
elif getattr(e, 'winerror', None) == 1142:
# OSError: [WinError 1142] An attempt was made to create more links on a file than
# the file system supports
do_copy()
else:
raise
elif os.path.exists(dest):
Expand Down