refactor: simplify Rust target directory cleanup logic

This commit is contained in:
Paul Gauthier 2025-01-03 14:16:49 -05:00 committed by Paul Gauthier (aider)
parent 3d501df21f
commit 98b0e88ace

View file

@ -854,14 +854,13 @@ def run_test_real(
instructions += prompts.test_failures.format(file_list=file_list)
# Clean up Rust target/debug directory after all attempts
if ".rs" in {Path(f).suffix for f in test_files}:
target_dir = testdir / "target" / "debug"
if target_dir.exists():
try:
shutil.rmtree(target_dir)
print(f"Cleaned up Rust target/debug directory: {target_dir}")
except Exception as e:
print(f"Failed to clean up Rust target/debug directory: {e}")
target_dir = testdir / "target" / "debug"
if target_dir.exists():
try:
shutil.rmtree(target_dir)
print(f"Cleaned up Rust target/debug directory: {target_dir}")
except Exception as e:
print(f"Failed to clean up Rust target/debug directory: {e}")
results = dict(
testdir=str(testdir),