This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

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:32memeplexsetrecipients: + memeplex
2016-02-17 01:28:32memeplexsetmessageid: <1455672512.72.0.551664124622.issue26372@psf.upfronthosting.co.za>
2016-02-17 01:28:32memeplexlinkissue26372 messages
2016-02-17 01:28:31memeplexcreate