MCPcopy Index your code
hub / github.com/python/cpython / async_process

Function async_process

Android/android.py:421–442  ·  view source on GitHub ↗
(*args, **kwargs)

Source from the content-addressed store, hash-verified

419# and they will always be cleaned up on exit.
420@asynccontextmanager
421async def async_process(*args, **kwargs):
422 process = await asyncio.create_subprocess_exec(*args, **kwargs)
423 try:
424 yield process
425 finally:
426 if process.returncode is None:
427 # Allow a reasonably long time for Gradle to clean itself up,
428 # because we don't want stale emulators left behind.
429 timeout = 10
430 process.terminate()
431 try:
432 await wait_for(process.wait(), timeout)
433 except TimeoutError:
434 print(
435 f"Command {args} did not terminate after {timeout} seconds "
436 f" - sending SIGKILL"
437 )
438 process.kill()
439
440 # Even after killing the process we must still wait for it,
441 # otherwise we'll get the warning "Exception ignored in __del__".
442 await wait_for(process.wait(), timeout=1)
443
444
445async def async_check_output(*args, **kwargs):

Callers 3

async_check_outputFunction · 0.85
logcat_taskFunction · 0.85
gradle_taskFunction · 0.85

Calls 4

wait_forFunction · 0.90
terminateMethod · 0.45
waitMethod · 0.45
killMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…