BenjyWiener · GitHub

Bug report

Bug description:

import subprocess
subprocess.check_call(['false'])

Output:

Traceback (most recent call last):
...
subprocess.CalledProcessError: Command '['false']' returned non-zero exit status 1.

Expected output:

Traceback (most recent call last):
...
subprocess.CalledProcessError: Command ['false'] returned non-zero exit status 1.

subprocess.CalledProcessError.__str__ manually quotes cmd via "... '%s' ..." instead of "%r". This results in (marginally) confusing error messages when cmd is a list or a string containing '.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

Read the original on github.com ↗