diff options
| author | Victor Stinner <victor.stinner@gmail.com> | 2014-07-17 10:48:33 (GMT) |
|---|---|---|
| committer | Victor Stinner <victor.stinner@gmail.com> | 2014-07-17 10:48:33 (GMT) |
| commit | 0d35741b167b6c7fdd201944c0e57379b1f246fd (patch) | |
| tree | 5aa00cc3059a2ae98498960b791f4be9eb58cb75 /Lib/asyncio/subprocess.py | |
| parent | 68f411670ec2145e783ea657c9d54a0a14815048 (diff) | |
| parent | cc996b57890a251cef83101d5cfcbc58179cba5f (diff) | |
| download | cpython-0d35741b167b6c7fdd201944c0e57379b1f246fd.zip cpython-0d35741b167b6c7fdd201944c0e57379b1f246fd.tar.gz cpython-0d35741b167b6c7fdd201944c0e57379b1f246fd.tar.bz2 | |
(Merge 3.4) 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.
Diffstat (limited to 'Lib/asyncio/subprocess.py')
| -rw-r--r-- | Lib/asyncio/subprocess.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/Lib/asyncio/subprocess.py b/Lib/asyncio/subprocess.py index 12902f1..23d6b4d 100644 --- a/Lib/asyncio/subprocess.py +++ b/Lib/asyncio/subprocess.py @@ -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) |
