From b547d500cc459421722da7511e900ed2a8858ada Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Thu, 2 Apr 2020 01:16:42 +0200 Subject: [PATCH] bpo-40094: Fix which.py script exit code It now uses os.waitstatus_to_exitcode() to convert os.system() exit status into an exit code. --- .../next/Tools-Demos/2020-04-02-01-22-21.bpo-40094.1XQQF6.rst | 3 +++ Tools/scripts/which.py | 1 + 2 files changed, 4 insertions(+) create mode 100644 Misc/NEWS.d/next/Tools-Demos/2020-04-02-01-22-21.bpo-40094.1XQQF6.rst 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 00000000000000..042550da8bc7f2 --- /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 df54ce032cbc8d..b42e07c74ecac8 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')