Returns whether the process died within the timeout, by polling returncode. Not process.wait(): on asyncio 3.11+ it also waits for pipe EOF, and a child that inherited the pipes makes an exited server look hung.
(process: ServerProcess, timeout: float)
| 274 | |
| 275 | |
| 276 | async def _wait_for_process_exit(process: ServerProcess, timeout: float) -> bool: |
| 277 | """Returns whether the process died within the timeout, by polling returncode. |
| 278 | |
| 279 | Not process.wait(): on asyncio 3.11+ it also waits for pipe EOF, and a |
| 280 | child that inherited the pipes makes an exited server look hung. |
| 281 | """ |
| 282 | deadline = anyio.current_time() + timeout |
| 283 | while process.returncode is None: |
| 284 | if anyio.current_time() >= deadline: |
| 285 | return False |
| 286 | await anyio.sleep(_EXIT_POLL_INTERVAL) |
| 287 | return True |
| 288 | |
| 289 | |
| 290 | async def _terminate_process_tree(process: ServerProcess) -> None: |
no outgoing calls
no test coverage detected