mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +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
|
@ -143,7 +143,11 @@ class Process:
|
|||
if self._loop.get_debug():
|
||||
logger.debug('%r communicate: feed stdin (%s bytes)',
|
||||
self, len(input))
|
||||
yield from self.stdin.drain()
|
||||
try:
|
||||
yield from self.stdin.drain()
|
||||
except BrokenPipeError:
|
||||
# ignore BrokenPipeError
|
||||
pass
|
||||
|
||||
if self._loop.get_debug():
|
||||
logger.debug('%r communicate: close stdin', self)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue