gh-138234: clarify returncode behavior for subprocesses created with shell=True (#138536)

Co-authored-by: Kumar Aditya <kumaraditya@python.org>
This commit is contained in:
andreuu-tsai 2026-03-21 20:32:28 +08:00 committed by GitHub
parent 60fbc20ef9
commit 8a531f89df
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View file

@ -311,8 +311,16 @@ their completion.
A ``None`` value indicates that the process has not terminated yet.
A negative value ``-N`` indicates that the child was terminated
by signal ``N`` (POSIX only).
For processes created with :func:`~asyncio.create_subprocess_exec`, a negative
value ``-N`` indicates that the child was terminated by signal ``N``
(POSIX only).
For processes created with :func:`~asyncio.create_subprocess_shell`, the
return code reflects the exit status of the shell itself (e.g. ``/bin/sh``),
which may map signals to codes such as ``128+N``. See the
documentation of the shell (for example, the Bash manual's Exit Status)
for details.
.. _asyncio-subprocess-threads:

View file

@ -964,6 +964,11 @@ Reassigning them to new values is unsupported:
A negative value ``-N`` indicates that the child was terminated by signal
``N`` (POSIX only).
When ``shell=True``, the return code reflects the exit status of the shell
itself (e.g. ``/bin/sh``), which may map signals to codes such as
``128+N``. See the documentation of the shell (for example, the Bash
manual's Exit Status) for details.
Windows Popen Helpers
---------------------