]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-40094: Fix which.py script exit code (GH-19286)
authorVictor Stinner <vstinner@python.org>
Thu, 2 Apr 2020 01:42:47 +0000 (03:42 +0200)
committerGitHub <noreply@github.com>
Thu, 2 Apr 2020 01:42:47 +0000 (03:42 +0200)
It now uses os.waitstatus_to_exitcode() to convert os.system() exit
status into an exit code.

Misc/NEWS.d/next/Tools-Demos/2020-04-02-01-22-21.bpo-40094.1XQQF6.rst [new file with mode: 0644]
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 (file)
index 0000000..042550d
--- /dev/null
@@ -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.
index df54ce032cbc8d42ffa791d005a7ba1f2eafa0c8..b42e07c74ecac838f9bdcea088fb680e962aac1a 100755 (executable)
@@ -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')