Improve linter error handling by replacing invalid characters and adding error handling for subprocess.

This commit is contained in:
Paul Gauthier 2024-07-30 15:21:01 -03:00 committed by Paul Gauthier (aider)
parent a84cad4a59
commit 59ad370611

View file

@ -44,8 +44,12 @@ class Linter:
cmd = cmd.split()
process = subprocess.Popen(
cmd, cwd=self.root, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
encoding=self.encoding
cmd,
cwd=self.root,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
encoding=self.encoding,
errors="replace",
)
stdout, _ = process.communicate()
errors = stdout
@ -141,7 +145,8 @@ class Linter:
capture_output=True,
text=True,
check=False,
encoding=self.encoding
encoding=self.encoding,
errors="replace",
)
errors = result.stdout + result.stderr
except Exception as e: