Skip to content

Commit

Permalink
Also look for errno.EACCES to ensure compatibility with Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
dktrkranz committed Feb 12, 2024
1 parent 5b00de9 commit f16fce6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions core/results.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import re
import os
import os.path as op
from errno import EISDIR
from errno import EISDIR, EACCES
from xml.etree import ElementTree as ET

from hscommon.jobprogress.job import nulljob
Expand Down Expand Up @@ -377,7 +377,7 @@ def do_write(outfile):
do_write(outfile)
except OSError as e:
# If our OSError is because dest is already a directory, we want to handle that.
if e.errno == EISDIR:
if e.errno in (EISDIR, EACCES):
p = str(outfile)
dirname, basename = op.split(p)
otherfiles = os.listdir(dirname)
Expand Down
4 changes: 2 additions & 2 deletions hscommon/conflict.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import os
import shutil

from errno import EISDIR
rom errno import EISDIR, EACCES
from pathlib import Path
from typing import Callable, List

Expand Down Expand Up @@ -76,7 +76,7 @@ def smart_copy(source_path: Path, dest_path: Path) -> None:
try:
_smart_move_or_copy(shutil.copy, source_path, dest_path)
except OSError as e:
if e.errno == EISDIR: # it's a directory
if e.errno in (EISDIR, EACCES): # it's a directory
_smart_move_or_copy(shutil.copytree, source_path, dest_path)
else:
raise

0 comments on commit f16fce6

Please sign in to comment.