Skip to content

Commit 8641c47

Browse files
[3.13] gh-118516: clarify that subprocess are automatically killed if transport gets garbage collected (GH-140997) (#141111)
gh-118516: clarify that subprocess are automatically killed if transport gets garbage collected (GH-140997) (cherry picked from commit 101c9c0) Co-authored-by: Kumar Aditya <[email protected]>
1 parent f671739 commit 8641c47

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

Doc/library/asyncio-eventloop.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1608,6 +1608,9 @@ async/await code consider using the high-level
16081608
conforms to the :class:`asyncio.SubprocessTransport` base class and
16091609
*protocol* is an object instantiated by the *protocol_factory*.
16101610

1611+
If the transport is closed or is garbage collected, the child process
1612+
is killed if it is still running.
1613+
16111614
.. method:: loop.subprocess_shell(protocol_factory, cmd, *, \
16121615
stdin=subprocess.PIPE, stdout=subprocess.PIPE, \
16131616
stderr=subprocess.PIPE, **kwargs)
@@ -1631,6 +1634,9 @@ async/await code consider using the high-level
16311634
conforms to the :class:`SubprocessTransport` base class and
16321635
*protocol* is an object instantiated by the *protocol_factory*.
16331636

1637+
If the transport is closed or is garbage collected, the child process
1638+
is killed if it is still running.
1639+
16341640
.. note::
16351641
It is the application's responsibility to ensure that all whitespace
16361642
and special characters are quoted appropriately to avoid `shell injection

Doc/library/asyncio-subprocess.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ Creating Subprocesses
7676
See the documentation of :meth:`loop.subprocess_exec` for other
7777
parameters.
7878

79+
If the process object is garbage collected while the process is still
80+
running, the child process will be killed.
81+
7982
.. versionchanged:: 3.10
8083
Removed the *loop* parameter.
8184

@@ -95,6 +98,9 @@ Creating Subprocesses
9598
See the documentation of :meth:`loop.subprocess_shell` for other
9699
parameters.
97100

101+
If the process object is garbage collected while the process is still
102+
running, the child process will be killed.
103+
98104
.. important::
99105

100106
It is the application's responsibility to ensure that all whitespace and

0 commit comments

Comments
 (0)