Add detailed error message when non-zero exit status occurs in Linter.

This commit is contained in:
Paul Gauthier 2024-05-18 18:57:14 -07:00
parent 04084883e8
commit 2e6c7a13b2

View file

@ -42,11 +42,14 @@ class Linter:
cmd = cmd.split()
try:
subprocess.check_output(cmd, cwd=self.root).decode()
print("zero")
return # zero exit status
except subprocess.CalledProcessError as err:
print("non-zero")
return err.output.decode() # non-zero exit status
errors = err.output.decode() # non-zero exit status
res = "# Running: {cmd]\n"
res += "If the output below indicates errors or problems, fix them.\n"
res += "But if the command fixed all the issues itself, don't take further action.\n\n"
res += errors
def lint(self, fname):
lang = filename_to_lang(fname)