Skip to content

Commit cd23839

Browse files
SitiSchuSimon Schuerrle
authored andcommitted
Force change permissions before deleting directory, fixes #1493
Signed-off-by: SitiSchu <[email protected]>
1 parent fca0b86 commit cd23839

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

src/rez/utils/filesystem.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -208,13 +208,11 @@ def _on_error(func, path, exc_info):
208208
path = windows_long_path(path)
209209

210210
parent_path = os.path.dirname(path)
211-
if not os.access(parent_path, os.W_OK):
212-
st = os.stat(parent_path)
213-
os.chmod(parent_path, st.st_mode | stat.S_IWUSR)
211+
st = os.stat(parent_path)
212+
os.chmod(parent_path, st.st_mode | stat.S_IWUSR)
214213

215-
if not os.access(path, os.W_OK):
216-
st = os.stat(path)
217-
os.chmod(path, st.st_mode | stat.S_IWUSR)
214+
st = os.stat(path)
215+
os.chmod(path, st.st_mode | stat.S_IWUSR)
218216

219217
except:
220218
# avoid confusion by ensuring original exception is reraised

0 commit comments

Comments
 (0)