mirror of
https://github.com/python/cpython.git
synced 2025-07-09 20:35:26 +00:00
asyncio, tulip issue 190: Process.communicate() now ignores
ConnectionResetError too
This commit is contained in:
parent
cc996b5789
commit
d55b54d5c0
2 changed files with 12 additions and 9 deletions
|
@ -139,17 +139,19 @@ class Process:
|
|||
|
||||
@coroutine
|
||||
def _feed_stdin(self, input):
|
||||
debug = self._loop.get_debug()
|
||||
self.stdin.write(input)
|
||||
if self._loop.get_debug():
|
||||
if debug:
|
||||
logger.debug('%r communicate: feed stdin (%s bytes)',
|
||||
self, len(input))
|
||||
try:
|
||||
yield from self.stdin.drain()
|
||||
except BrokenPipeError:
|
||||
# ignore BrokenPipeError
|
||||
pass
|
||||
except (BrokenPipeError, ConnectionResetError) as exc:
|
||||
# communicate() ignores BrokenPipeError and ConnectionResetError
|
||||
if debug:
|
||||
logger.debug('%r communicate: stdin got %r', self, exc)
|
||||
|
||||
if self._loop.get_debug():
|
||||
if debug:
|
||||
logger.debug('%r communicate: close stdin', self)
|
||||
self.stdin.close()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue