mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
gh-83925: Make asyncio.subprocess communicate similar to non-asyncio (#18650)
subprocess's communicate(None) closes stdin of the child process, after sending no (extra) data. Make asyncio variant do the same. This fixes issues with processes that waits for EOF on stdin before continuing.
This commit is contained in:
parent
424a785a07
commit
67d140dba7
4 changed files with 32 additions and 7 deletions
|
@ -207,8 +207,9 @@ their completion.
|
|||
Interact with process:
|
||||
|
||||
1. send data to *stdin* (if *input* is not ``None``);
|
||||
2. read data from *stdout* and *stderr*, until EOF is reached;
|
||||
3. wait for process to terminate.
|
||||
2. closes *stdin*;
|
||||
3. read data from *stdout* and *stderr*, until EOF is reached;
|
||||
4. wait for process to terminate.
|
||||
|
||||
The optional *input* argument is the data (:class:`bytes` object)
|
||||
that will be sent to the child process.
|
||||
|
@ -229,6 +230,10 @@ their completion.
|
|||
Note, that the data read is buffered in memory, so do not use
|
||||
this method if the data size is large or unlimited.
|
||||
|
||||
.. versionchanged:: 3.12
|
||||
|
||||
*stdin* gets closed when `input=None` too.
|
||||
|
||||
.. method:: send_signal(signal)
|
||||
|
||||
Sends the signal *signal* to the child process.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue