Skip to content

Commit

Permalink
#378 Get a nice error message when running diff-quality with a tool w…
Browse files Browse the repository at this point in the history
…hich is not installed (#380)

* #378 Add shell=True to check for program existence

* Update command_runner.py

Black is upset, looks like the change is simple enough

* #378 Explicitly check for FileNotFound instead

---------

Co-authored-by: Matt Bachmann <[email protected]>
  • Loading branch information
d-perl and Bachmann1234 authored Dec 16, 2023
1 parent c37cdbe commit d6ec6af
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions diff_cover/command_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,13 @@ def run_command_for_code(command):
"""
Returns command's exit code.
"""
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
process.communicate()
try:
process = subprocess.Popen(
command, stdout=subprocess.PIPE, stderr=subprocess.PIPE
)
process.communicate()
except FileNotFoundError:
return 1
return process.returncode


Expand Down

0 comments on commit d6ec6af

Please sign in to comment.