bpo-38456: Handle the case when there is no 'true' command (GH-16739)

This commit is contained in:
Pablo Galindo 2019-10-13 02:40:24 +01:00 committed by GitHub
parent 27b33fb41a
commit 46113e0cf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -59,6 +59,8 @@ ZERO_RETURN_CMD = (sys.executable, '-c', 'pass')
def setUpModule():
shell_true = shutil.which('true')
if shell_true is None:
return
if (os.access(shell_true, os.X_OK) and
subprocess.run([shell_true]).returncode == 0):
global ZERO_RETURN_CMD