| 348 | await asyncio.sleep(0.01) # Give write time to complete |
| 349 | |
| 350 | class _Proc: |
| 351 | def __init__(self): |
| 352 | self.stdin = _Stdin() # type: ignore |
| 353 | self.stdout = reader |
| 354 | self.pid = child.pid |
| 355 | self.returncode = None |
| 356 | |
| 357 | async def wait(self): |
| 358 | while child.isalive(): |
| 359 | await asyncio.sleep(0.2) |
| 360 | self.returncode = 0 |
| 361 | return 0 |
| 362 | |
| 363 | def terminate(self): |
| 364 | if child.isalive(): |
| 365 | child.terminate() |
| 366 | |
| 367 | def kill(self): |
| 368 | if child.isalive(): |
| 369 | child.kill() |
| 370 | |
| 371 | return _Proc() |
| 372 |