Issue 23508: Document & unittest the subprocess.getstatusoutput() status value (original) (raw)
Issue23508
Created on 2015-02-24 08:56 by gregory.p.smith, last changed 2022-04-11 14:58 by admin. This issue is now closed.
Messages (3) | ||
---|---|---|
msg236482 - (view) | Author: Gregory P. Smith (gregory.p.smith) * ![]() |
Date: 2015-02-24 08:56 |
The changes from http://bugs.python.org/issue10197 caused subprocess.getstatusoutput() to start returning a subprocess returncode style status for the child process instead of a POSIX style status. before that bug's changes: >>> getstatusoutput("exit 1")[0] 256 >>> getstatusoutput("kill -TERM ")[0] 15 after that bug's changes: >>> getstatusoutput("exit 1")[0] 1 >>> getstatusoutput("kill -TERM ")[0] -15 This behavior was entirely untested so it was missed when fixing . Given the new behavior has shipped in a stable Python release starting with (I believe) 3.3.4 and all 3.4 releases I do not think it should be changed. But we should document it with proper versionchanged notices. | ||
msg236532 - (view) | Author: Gregory P. Smith (gregory.p.smith) * ![]() |
Date: 2015-02-24 19:30 |
Workaround: To determine the behavior of the interpreter your POSIX program is running under rather than a hard coded patch level version check, write appropriate conditional code to perform a test such as: _returns_new_status = subprocess.getstatusoutput('kill ')[0] < 0 | ||
msg302219 - (view) | Author: Gregory P. Smith (gregory.p.smith) * ![]() |
Date: 2017-09-14 22:01 |
documentation updates as part of . |
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-04-11 14:58:13 | admin | set | github: 67696 |
2017-09-14 22:01:32 | gregory.p.smith | set | status: open -> closedtype: behaviorsuperseder: subprocess.getstatusoutput changed behavior in 3.4 (maybe 3.3.4?)assignee: gregory.p.smithcomponents: + Documentationversions: + Python 3.3, Python 3.4, Python 3.5, Python 3.6, Python 3.7messages: + resolution: fixedstage: resolved |
2015-02-25 10:04:46 | Arfrever | set | nosy: + Arfrever |
2015-02-24 19:30:51 | gregory.p.smith | set | messages: + |
2015-02-24 08:56:18 | gregory.p.smith | create |