mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
fix: Handle empty and commented shell commands in EditBlockCoder
This commit is contained in:
parent
a9fe599591
commit
eb43a1fb43
1 changed files with 12 additions and 2 deletions
|
@ -42,20 +42,30 @@ class EditBlockCoder(Coder):
|
||||||
failed = []
|
failed = []
|
||||||
passed = []
|
passed = []
|
||||||
|
|
||||||
|
dump(edits)
|
||||||
for edit in edits:
|
for edit in edits:
|
||||||
|
dump(edit)
|
||||||
if edit[0] is None:
|
if edit[0] is None:
|
||||||
edit = edit[1]
|
edit = edit[1]
|
||||||
# This is a shell command
|
# This is a shell command
|
||||||
commands = edit.strip().split("\n")
|
commands = edit.strip().splitlines()
|
||||||
if self.io.confirm_ask("Run shell command(s)?", subject="\n".join(commands)):
|
if self.io.confirm_ask("Run shell command(s)?", subject="\n".join(commands)):
|
||||||
self.io.tool_output()
|
|
||||||
for command in commands:
|
for command in commands:
|
||||||
|
command = command.strip()
|
||||||
|
if not command:
|
||||||
|
continue
|
||||||
|
if command.startswith('#'):
|
||||||
|
continue
|
||||||
|
|
||||||
|
self.io.tool_output()
|
||||||
|
self.io.tool_output(f"Running {command}")
|
||||||
try:
|
try:
|
||||||
# Add the command to input history
|
# Add the command to input history
|
||||||
self.io.add_to_input_history(f"/run {command.strip()}")
|
self.io.add_to_input_history(f"/run {command.strip()}")
|
||||||
self.run_interactive_subprocess(command.split())
|
self.run_interactive_subprocess(command.split())
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.io.tool_error(f"Error running command '{command}': {str(e)}")
|
self.io.tool_error(f"Error running command '{command}': {str(e)}")
|
||||||
|
continue
|
||||||
else:
|
else:
|
||||||
path, original, updated = edit
|
path, original, updated = edit
|
||||||
full_path = self.abs_root_path(path)
|
full_path = self.abs_root_path(path)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue