windows_proof_rmtree: Also retry os.chmod() part

It looks like when Windows media scanner holds files we can't change
their permission neither.
pull/8587/head
Xavier Claessens 4 years ago committed by Jussi Pakkanen
parent 56c03e1517
commit 64775c0fd3
  1. 11
      mesonbuild/mesonlib/universal.py

@ -1530,9 +1530,16 @@ def windows_proof_rmtree(f: str) -> None:
# be scanning files you are trying to delete. The only
# way to fix this is to try again and again.
delays = [0.1, 0.1, 0.2, 0.2, 0.2, 0.5, 0.5, 1, 1, 1, 1, 2]
# Start by making the tree wriable.
_make_tree_writable(f)
writable = False
for d in delays:
try:
# Start by making the tree writable.
if not writable:
_make_tree_writable(f)
writable = True
except PermissionError:
time.sleep(d)
continue
try:
shutil.rmtree(f)
return

Loading…
Cancel
Save