()
| 801 | time.sleep(1) |
| 802 | |
| 803 | def target(): |
| 804 | global backend_process |
| 805 | |
| 806 | backend_process = run_fn() |
| 807 | |
| 808 | # atexit.register isn't 100% reliable, that's why we also use `forge_monitor_parent_process.patch` |
| 809 | # which causes Forge to kill itself if the parent pid passed to it is no longer valid. |
| 810 | atexit.register(backend_process.terminate) |
| 811 | |
| 812 | restart_if_dead_thread = Thread(target=restart_if_webui_dies_after_starting) |
| 813 | restart_if_dead_thread.start() |
| 814 | |
| 815 | backend_process.wait() |
| 816 | |
| 817 | backend_thread = Thread(target=target) |
| 818 | backend_thread.start() |
no test coverage detected