Message260373
| Author |
memeplex |
| Recipients |
memeplex |
| Date |
2016年02月17日.01:28:31 |
| SpamBayes Score |
-1.0 |
| Marked as misclassified |
Yes |
| Message-id |
<1455672512.72.0.551664124622.issue26372@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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. |
|
History
|
|---|
| 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 |
|