Remove crash dump and leftover GDB temp files from .gdb_crash/ and project root.
()
| 82 | |
| 83 | |
| 84 | def cleanup_crash_dump_files() -> None: |
| 85 | """Remove crash dump and leftover GDB temp files from .gdb_crash/ and project root.""" |
| 86 | import shutil |
| 87 | |
| 88 | # Clean up .gdb_crash/ directory |
| 89 | crash_dir = Path(".gdb_crash") |
| 90 | if crash_dir.exists(): |
| 91 | count = sum(1 for _ in crash_dir.iterdir()) |
| 92 | if count > 0: |
| 93 | print(f"🧹 Cleaning {count} crash dump file(s) from .gdb_crash/") |
| 94 | try: |
| 95 | shutil.rmtree(crash_dir) |
| 96 | except KeyboardInterrupt: |
| 97 | _thread.interrupt_main() |
| 98 | raise |
| 99 | except Exception: |
| 100 | pass |
| 101 | |
| 102 | # Clean up legacy gdb_temp_*.gdb files left in project root |
| 103 | for file_path in Path(".").glob("gdb_temp_*.gdb"): |
| 104 | try: |
| 105 | print(f"🧹 Removing legacy crash file: {file_path}") |
| 106 | file_path.unlink() |
| 107 | except KeyboardInterrupt: |
| 108 | _thread.interrupt_main() |
| 109 | raise |
| 110 | except Exception: |
| 111 | pass |
| 112 | |
| 113 | |
| 114 | def print_header(js_only: bool, cpp_only: bool) -> None: |