[New-bugs-announce] [issue27167] subprocess reports signal as negative exit status, not documented
report at bugs.python.org
Tue May 31 12:35:00 EDT 2016
New submission from David MacKenzie:
If a command run by subprocess.check_call() exits because of a signal, e.g. SIGPIPE, Popen._handle_exitstatus() encodes the signal number as a negative return code. check_call() then raises that as a CalledProcessError, which describes it as "returned non-zero exit status -13". This is misleading and undocumented.
CalledProcessError.__str__() should check if self.returncode is negative and if so return a string indicating that it was "signal 13", not "exit status -13". Better yet, it should include the descriptive name of the signal, e.g., SIGPIPE.
And, the documentation for the subprocess module should note that a signal is converted into a negative returncode.
components: Library (Lib)
title: subprocess reports signal as negative exit status, not documented
versions: Python 3.5
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce