[Python-checkins] bpo-40094: Fix which.py script exit code (GH-19286)
Victor Stinner
webhook-mailer at python.org
Wed Apr 1 21:42:51 EDT 2020
https://github.com/python/cpython/commit/e7c98f08e228e9f6e139d61e3e5d0a5018a38f0b
commit: e7c98f08e228e9f6e139d61e3e5d0a5018a38f0b
branch: master
author: Victor Stinner <vstinner at python.org>
committer: GitHub <noreply at github.com>
date: 2020-04-02T03:42:47+02:00
summary:
bpo-40094: Fix which.py script exit code (GH-19286)
It now uses os.waitstatus_to_exitcode() to convert os.system() exit
status into an exit code.
files:
A Misc/NEWS.d/next/Tools-Demos/2020-04-02-01-22-21.bpo-40094.1XQQF6.rst
M Tools/scripts/which.py
diff --git a/Misc/NEWS.d/next/Tools-Demos/2020-04-02-01-22-21.bpo-40094.1XQQF6.rst b/Misc/NEWS.d/next/Tools-Demos/2020-04-02-01-22-21.bpo-40094.1XQQF6.rst
new file mode 100644
index 0000000000000..042550da8bc7f
--- /dev/null
+++ b/Misc/NEWS.d/next/Tools-Demos/2020-04-02-01-22-21.bpo-40094.1XQQF6.rst
@@ -0,0 +1,3 @@
+Fix ``which.py`` script exit code: it now uses
+:func:`os.waitstatus_to_exitcode` to convert :func:`os.system` exit status
+into an exit code.
diff --git a/Tools/scripts/which.py b/Tools/scripts/which.py
index df54ce032cbc8..b42e07c74ecac 100755
--- a/Tools/scripts/which.py
+++ b/Tools/scripts/which.py
@@ -49,6 +49,7 @@ def main():
msg(filename + ': not executable')
if longlist:
sts = os.system('ls ' + longlist + ' ' + filename)
+ sts = os.waitstatus_to_exitcode(sts)
if sts: msg('"ls -l" exit status: ' + repr(sts))
if not ident:
msg(prog + ': not found')
More information about the Python-checkins
mailing list