Consumes and discards the server's remaining stdout. Keeps a server flushing buffered output from blocking on a full pipe and missing its chance to exit; shielded, raw bytes, ends when shutdown closes the pipe.
(process: ServerProcess)
| 226 | |
| 227 | |
| 228 | async def _drain_stdout(process: ServerProcess) -> None: |
| 229 | """Consumes and discards the server's remaining stdout. |
| 230 | |
| 231 | Keeps a server flushing buffered output from blocking on a full pipe and |
| 232 | missing its chance to exit; shielded, raw bytes, ends when shutdown closes |
| 233 | the pipe. |
| 234 | """ |
| 235 | assert process.stdout |
| 236 | with anyio.CancelScope(shield=True): |
| 237 | with suppress( |
| 238 | anyio.EndOfStream, |
| 239 | anyio.ClosedResourceError, |
| 240 | anyio.BrokenResourceError, |
| 241 | ConnectionError, |
| 242 | OSError, |
| 243 | ): |
| 244 | while True: |
| 245 | await process.stdout.receive() |
| 246 | |
| 247 | |
| 248 | async def _stop_server_process(process: ServerProcess) -> None: |
no test coverage detected