← All notes

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

Sources

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

Permanent ID: iil:note:ft0494nw

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.},
}

Markdown

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.

All artifact files (JSON index)

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.