Message260373
When not using a timeout, communicate will raise a BrokenPipeError if the command returns an error code. For example:
sp = subprocess.Popen('cat --not-an-option', shell=True, stdin=subprocess.PIPE)
time.sleep(.2)
sp.communicate(b'hi\n')
This isn't consistent with the behavior of communicate with a timeout, which doesn't raise the exception. Moreover, there is even a comment near the point of the exception stating that communicate must ignore BrokenPipeError:
def _stdin_write(self, input):
if input:
try:
self.stdin.write(input)
except BrokenPipeError:
# communicate() must ignore broken pipe error
pass
....
self.stdin.close()
Obviously, the problem is that self.stdin.close() is outside the except clause. |
|
Date |
User |
Action |
Args |
2016-02-17 01:28:32 | memeplex | set | recipients:
+ memeplex |
2016-02-17 01:28:32 | memeplex | set | messageid: <1455672512.72.0.551664124622.issue26372@psf.upfronthosting.co.za> |
2016-02-17 01:28:32 | memeplex | link | issue26372 messages |
2016-02-17 01:28:31 | memeplex | create | |
|