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.
This commit is contained in:
Victor Stinner 2020-04-02 03:42:47 +02:00 committed by GitHub
parent 9a679a0e47
commit e7c98f08e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 0 deletions

View file

@ -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.

View file

@ -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')