Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.

Commit 3113225

Browse files
authored
Better error message when try_to_run command fails
The `CalledProcessError` object should always have a `.output` attribute, although it may be None, so the `getattr()` will never hit the fallback condition. The logical `or` operator should use the fallback if `e.output` is either None or an empty string, because those are both false-y. Any other possible value will be shown.
1 parent 0b96aba commit 3113225

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

codecov/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ def try_to_run(cmd):
181181
try:
182182
return check_output(cmd, shell=True)
183183
except subprocess.CalledProcessError as e:
184-
write(' Error running `%s`: %s' % (cmd, str(getattr(e, 'output', str(e)))))
184+
write(' Error running `%s`: %s' % (cmd, e.output or str(e)))
185185

186186

187187
def remove_non_ascii(data):

0 commit comments

Comments
 (0)