INNER CODE UNIT · Python

on_rm_error

Silverlan/pragma · build_scripts/build_third_party_libs.py:15

def on_rm_error(func, path, exc_info):
	# Try to make writable and try removal once more
	try:
		os.chmod(path, stat.S_IWRITE)
	except Exception:
		pass
	try:
		func(path)
	except Exception:
		raise

def safe_remove_tree(path, retries=5, delay=0.5):
	p = Path(path)
	if not p.exists():
		return True

	# .git dir is often problematic because it may still be in use by the system, so we'll try to delete it first
	git_dir = p / '.git'

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…