mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-30 09:14:59 +00:00
feat: Implement shell command execution in EditBlockCoder
This commit is contained in:
parent
682294118d
commit
6f0d9a09df
1 changed files with 10 additions and 3 deletions
|
@ -2,6 +2,7 @@ import difflib
|
||||||
import math
|
import math
|
||||||
import re
|
import re
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
from difflib import SequenceMatcher
|
from difflib import SequenceMatcher
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
@ -40,9 +41,15 @@ class EditBlockCoder(Coder):
|
||||||
# This is a shell command
|
# This is a shell command
|
||||||
self.io.tool_output(f"Shell command: {edit}")
|
self.io.tool_output(f"Shell command: {edit}")
|
||||||
if self.io.confirm_ask("Do you want to run this command?"):
|
if self.io.confirm_ask("Do you want to run this command?"):
|
||||||
# Here you would add logic to run the shell command
|
try:
|
||||||
self.io.tool_output("Command execution placeholder")
|
result = subprocess.run(edit, shell=True, check=True, text=True, capture_output=True)
|
||||||
passed.append(edit)
|
self.io.tool_output(f"Command executed successfully. Output:\n{result.stdout}")
|
||||||
|
if result.stderr:
|
||||||
|
self.io.tool_output(f"Errors:\n{result.stderr}")
|
||||||
|
passed.append(edit)
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
self.io.tool_error(f"Command execution failed. Error:\n{e.stderr}")
|
||||||
|
failed.append(edit)
|
||||||
else:
|
else:
|
||||||
self.io.tool_output("Command execution skipped.")
|
self.io.tool_output("Command execution skipped.")
|
||||||
failed.append(edit)
|
failed.append(edit)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue