diff --git a/scripts/run_cmake.py b/scripts/run_cmake.py index 61bd5fb..5ca36cc 100755 --- a/scripts/run_cmake.py +++ b/scripts/run_cmake.py @@ -159,10 +159,12 @@ def secure_delete(path: str): for root, dirs, files in os.walk(name, topdown=False): for name in files: - p = Path (os.path.join(root, name)) + p = Path(os.path.join(root, name)) p.chmod(stat.S_IWRITE) - - shutil.rmtree(name) + if os.path.isdir(name): + shutil.rmtree(name) + else: + os.unlink(name) shutil.rmtree(path, onerror=del_rw)