mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
asyncio, tulip issue 190: Process.communicate() must ignore BrokenPipeError
If you want to handle the BrokenPipeError, you can easily reimplement communicate(). Add also a unit test to ensure that stdin.write() + stdin.drain() raises BrokenPipeError.
This commit is contained in:
parent
38bf87c7f2
commit
cc996b5789
3 changed files with 32 additions and 8 deletions
|
@ -191,6 +191,10 @@ Process
|
|||
process, or ``None``, if no data should be sent to the child. The type
|
||||
of *input* must be bytes.
|
||||
|
||||
If a :exc:`BrokenPipeError` is raised when writing *input* into stdin,
|
||||
the exception is ignored. It occurs when the process exits before all
|
||||
data are written into stdin.
|
||||
|
||||
:meth:`communicate` returns a tuple ``(stdoutdata, stderrdata)``.
|
||||
|
||||
Note that if you want to send data to the process's stdin, you need to
|
||||
|
@ -205,6 +209,9 @@ Process
|
|||
|
||||
This method is a :ref:`coroutine <coroutine>`.
|
||||
|
||||
.. versionchanged:: 3.4.2
|
||||
The method now ignores :exc:`BrokenPipeError`.
|
||||
|
||||
.. method:: kill()
|
||||
|
||||
Kills the child. On Posix OSs the function sends :py:data:`SIGKILL` to
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue