mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 17:55:01 +00:00
Improve linter error handling by replacing invalid characters and adding error handling for subprocess.
This commit is contained in:
parent
a84cad4a59
commit
59ad370611
1 changed files with 8 additions and 3 deletions
|
@ -44,8 +44,12 @@ class Linter:
|
||||||
cmd = cmd.split()
|
cmd = cmd.split()
|
||||||
|
|
||||||
process = subprocess.Popen(
|
process = subprocess.Popen(
|
||||||
cmd, cwd=self.root, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
|
cmd,
|
||||||
encoding=self.encoding
|
cwd=self.root,
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.STDOUT,
|
||||||
|
encoding=self.encoding,
|
||||||
|
errors="replace",
|
||||||
)
|
)
|
||||||
stdout, _ = process.communicate()
|
stdout, _ = process.communicate()
|
||||||
errors = stdout
|
errors = stdout
|
||||||
|
@ -141,7 +145,8 @@ class Linter:
|
||||||
capture_output=True,
|
capture_output=True,
|
||||||
text=True,
|
text=True,
|
||||||
check=False,
|
check=False,
|
||||||
encoding=self.encoding
|
encoding=self.encoding,
|
||||||
|
errors="replace",
|
||||||
)
|
)
|
||||||
errors = result.stdout + result.stderr
|
errors = result.stdout + result.stderr
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue