Python asyncio subprocesses: create and manage child processes
Answer: asyncio provides high-level async/await APIs to create and manage subprocesses.
Creating a subprocess
create_subprocess_exec and create_subprocess_shell both return a Process instance.
Process is a high-level wrapper that allows communicating with subprocesses and watching for completion.
PIPE can be passed for stdin, stdout, or stderr.
DEVNULL means the corresponding stream uses the special file os.devnull.
Platform notes and lifetime
On Windows, subprocesses are available when a ProactorEventLoop is used.
The Process class is not thread safe.
On POSIX systems, terminate sends SIGTERM to the child process.
On POSIX systems, kill sends SIGKILL to the child process.
See also
Claims
- id: C1 claim: These APIs are high-level async/await helpers for subprocesses. source: S1 evidence: "This section describes high-level async/await asyncio APIs to create and manage subprocesses."
- id: C2 claim: Subprocesses on Windows need a ProactorEventLoop. source: S1 evidence: "Subprocesses are available for Windows if a ProactorEventLoop is used."
- id: C3 claim: The Process class is not thread safe. source: S2 evidence: "This class is :ref:
not thread safe <asyncio-multithreading>."
- id: C4 claim: On POSIX systems, terminate sends SIGTERM to the child. source: S2 evidence: "On POSIX systems this method sends :py:const:
~signal.SIGTERMto the child process."
Sources
- [S1] Subprocesses. Python Software Foundation. https://docs.python.org/3/library/asyncio-subprocess.html . License: PSF License Version 2. Accessed 2026-11-26.
- [S2] Subprocesses documentation (source). CPython. https://raw.githubusercontent.com/python/cpython/main/Doc/library/asyncio-subprocess.rst . License: PSF License Version 2. Accessed 2026-11-26.
License: this note is CC BY 4.0 (https://creativecommons.org/licenses/by/4.0/). Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, Subprocesses; CPython, Subprocesses documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation. Text was condensed and changed from the originals.
License: CC-BY-4.0 · Summary by iinventedlight (AI-assisted). Sources: Python Software Foundation, Subprocesses; CPython, Subprocesses documentation (source). PSF-2.0 (https://docs.python.org/3/license.html). Copyright Python Software Foundation.
Cite this
iinventedlight. 2026. "Python asyncio subprocesses: create and manage child processes." iinventedlight Library, iil:note:ft0494nw, version of 2026-11-26. https://iinventedlight.com/library/notes/python-asyncio-subprocess/. License: CC-BY-4.0.
@misc{iil_note_ft0494nw,
author = {{iinventedlight}},
title = {{Python asyncio subprocesses: create and manage child processes}},
howpublished = {iinventedlight Library},
year = {2026},
date = {2026-11-26},
url = {https://iinventedlight.com/library/notes/python-asyncio-subprocess/},
note = {Permanent ID iil:note:ft0494nw. License: CC-BY-4.0.},
}
Spotted a mistake? Use the MCP feedback tool or email hello@iinventedlight.com. Or Report a correction (no account needed).
Extra files beside this note
These files use this note's license, shown below. Paper extras retain their reproduction status; a link is not a reproduction.
- python-asyncio-subprocess.schema.json (schema; CC-BY-4.0)
- python-asyncio-subprocess.table.json (table; CC-BY-4.0)
For language models and agents: start at /llms.txt | /agents.md | /.well-known/agent-library.json. This page in Markdown: /library/notes/python-asyncio-subprocess.md.