Issue 27167: subprocess reports signal as negative exit status, not documented (original) (raw)
Issue27167
Created on 2016-05-31 16:35 by dmacnet, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Messages (7) | ||
---|---|---|
msg266758 - (view) | Author: David MacKenzie (dmacnet) | Date: 2016-05-31 16:35 |
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. | ||
msg266760 - (view) | Author: Gregory P. Smith (gregory.p.smith) * ![]() |
Date: 2016-05-31 16:43 |
I'll take this as a documentation update for 3.5 and a feature request for better message text in 3.6. | ||
msg267009 - (view) | Author: Gregory P. Smith (gregory.p.smith) * ![]() |
Date: 2016-06-03 00:34 |
docs updated (7b12180481da and 19d77132f38d). working on the error message update. | ||
msg267052 - (view) | Author: Roundup Robot (python-dev) ![]() |
Date: 2016-06-03 06:14 |
New changeset f2d13349ea5d by Gregory P. Smith in branch 'default': Issue #27167: Clarify the subprocess.CalledProcessError error message text https://hg.python.org/cpython/rev/f2d13349ea5d | ||
msg267055 - (view) | Author: Roundup Robot (python-dev) ![]() |
Date: 2016-06-03 06:19 |
New changeset 1022d09d11e5 by Gregory P. Smith in branch 'default': : make the test not care about the exact signal name in the https://hg.python.org/cpython/rev/1022d09d11e5 | ||
msg267056 - (view) | Author: Gregory P. Smith (gregory.p.smith) * ![]() |
Date: 2016-06-03 06:24 |
So this is mostly done... one oddity which may warrant improvement though: signal numbers have multiple names. ie: SIGABRT is also known as SIGIOT, etc. This is likely to be confusing to if the error message is surfaced to the user as most users only know one common name rather than all of them as described in their system headers or the signal(7) man page. I'd rather Python not be in the business of picking which name is more popular, but it can generate different error messages for the same signal across repeated runs due to hash randomization changing the order of the map in the signal.Signals type. run python3.5 -c 'import signal; print(signal.Signals(6))' a handful of times to see this. | ||
msg267140 - (view) | Author: Roundup Robot (python-dev) ![]() |
Date: 2016-06-03 19:15 |
New changeset 365b5e6163a6 by Gregory P. Smith in branch 'default': signal, socket, and ssl module IntEnum constant name lookups now return a https://hg.python.org/cpython/rev/365b5e6163a6 |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:31 | admin | set | github: 71354 |
2016-06-03 19:15:46 | gregory.p.smith | set | status: open -> closedresolution: fixed |
2016-06-03 19:15:03 | python-dev | set | messages: + |
2016-06-03 06:25:16 | gregory.p.smith | set | versions: - Python 3.5 |
2016-06-03 06:24:51 | gregory.p.smith | set | messages: + |
2016-06-03 06:19:47 | python-dev | set | messages: + |
2016-06-03 06:14:25 | python-dev | set | nosy: + python-devmessages: + |
2016-06-03 00:34:21 | gregory.p.smith | set | messages: + |
2016-05-31 16:43:02 | gregory.p.smith | set | versions: + Python 3.6nosy: + gregory.p.smithmessages: + assignee: gregory.p.smith |
2016-05-31 16:35:00 | dmacnet | create |