()
| 146 | from tools.app_runner import run |
| 147 | |
| 148 | def _force_stop() -> None: |
| 149 | c = crawler |
| 150 | if not c: |
| 151 | return |
| 152 | cdp_manager = getattr(c, "cdp_manager", None) |
| 153 | launcher = getattr(cdp_manager, "launcher", None) |
| 154 | if not launcher: |
| 155 | return |
| 156 | try: |
| 157 | launcher.cleanup() |
| 158 | except Exception: |
| 159 | pass |
| 160 | |
| 161 | run(main, async_cleanup, cleanup_timeout_seconds=15.0, on_first_interrupt=_force_stop) |