refactor: improve cleanup error handling and verbose logging

This commit is contained in:
Paul Gauthier (aider) 2025-01-04 10:55:11 -08:00
parent ac160cac12
commit c5919f0c15

View file

@ -859,9 +859,10 @@ def run_test_real(
if target_dir.exists():
try:
shutil.rmtree(target_dir)
if verbose:
print(f"Cleaned up Rust target/debug directory: {target_dir}")
except Exception as e:
# ignore all these exceptions on cleanup. ai!
except (OSError, shutil.Error, PermissionError) as e:
if verbose:
print(f"Failed to clean up Rust target/debug directory: {e}")
# Java build directories
@ -869,8 +870,10 @@ def run_test_real(
if java_build_dir.exists():
try:
shutil.rmtree(java_build_dir)
if verbose:
print(f"Cleaned up Java build directory: {java_build_dir}")
except Exception as e:
except (OSError, shutil.Error, PermissionError) as e:
if verbose:
print(f"Failed to clean up Java build directory: {e}")
# Node.js node_modules directories
@ -878,8 +881,10 @@ def run_test_real(
if node_modules_dir.exists():
try:
shutil.rmtree(node_modules_dir)
if verbose:
print(f"Cleaned up Node.js node_modules directory: {node_modules_dir}")
except Exception as e:
except (OSError, shutil.Error, PermissionError) as e:
if verbose:
print(f"Failed to clean up Node.js node_modules directory: {e}")
results = dict(