From 2e6c7a13b2ba52d3d96afbf5dc1638e4e504c622 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 18 May 2024 18:57:14 -0700 Subject: [PATCH] Add detailed error message when non-zero exit status occurs in Linter. --- aider/linter.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/aider/linter.py b/aider/linter.py index 42670fc58..f94d37cc2 100644 --- a/aider/linter.py +++ b/aider/linter.py @@ -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)