Skip to content

Commit

Permalink
ignore same file errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Nov 13, 2024
1 parent 450cb5b commit 966d926
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions CIME/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -1409,10 +1409,14 @@ def safe_copy(src_path, tgt_path, preserve_meta=True):

if owner_uid == os.getuid():
# I am the owner, copy file contents, permissions, and metadata
shutil.copy2(
src_path,
tgt_path,
)
try:
shutil.copy2(
src_path,
tgt_path,
)
# ignore same file error
except shutil.SameFileError:
pass
else:
# I am not the owner, just copy file contents
shutil.copyfile(src_path, tgt_path)
Expand Down

0 comments on commit 966d926

Please sign in to comment.