Main entry point.
()
| 323 | |
| 324 | |
| 325 | def main() -> int: |
| 326 | """Main entry point.""" |
| 327 | parser = argparse.ArgumentParser( |
| 328 | description="Diagnose serial port locking issues", |
| 329 | epilog="Example: uv run python ci/debug/port_diagnostic.py COM4", |
| 330 | ) |
| 331 | parser.add_argument( |
| 332 | "port", help="Serial port to diagnose (e.g., COM4, /dev/ttyUSB0)" |
| 333 | ) |
| 334 | |
| 335 | args = parser.parse_args() |
| 336 | |
| 337 | try: |
| 338 | diagnose_port(args.port) |
| 339 | return 0 |
| 340 | except KeyboardInterrupt as ki: |
| 341 | handle_keyboard_interrupt(ki) |
| 342 | raise |
| 343 | except Exception as e: |
| 344 | print(f"❌ Error during diagnosis: {e}", file=sys.stderr) |
| 345 | import traceback |
| 346 | |
| 347 | traceback.print_exc() |
| 348 | return 1 |
| 349 | |
| 350 | |
| 351 | if __name__ == "__main__": |
no test coverage detected