mirror of
https://github.com/Aider-AI/aider.git
synced 2025-06-01 10:14:59 +00:00
fix: Improve run_interactive_subprocess method in EditBlockCoder
This commit is contained in:
parent
a2cb660183
commit
377da1537d
1 changed files with 7 additions and 12 deletions
|
@ -29,14 +29,13 @@ class EditBlockCoder(Coder):
|
||||||
return edits
|
return edits
|
||||||
|
|
||||||
def run_interactive_subprocess(self, command):
|
def run_interactive_subprocess(self, command):
|
||||||
dump(repr(command))
|
return subprocess.run(
|
||||||
if os.name == "posix": # Unix-like systems (Linux, macOS)
|
command,
|
||||||
return subprocess.run(command, shell=True)
|
text=True,
|
||||||
# return pty.spawn(command)
|
shell=True,
|
||||||
elif os.name == "nt": # Windows
|
encoding=self.io.encoding,
|
||||||
return subprocess.run(command, shell=True)
|
errors="replace",
|
||||||
else:
|
)
|
||||||
raise OSError("Unsupported operating system")
|
|
||||||
|
|
||||||
def handle_shell_commands(self, commands_str):
|
def handle_shell_commands(self, commands_str):
|
||||||
commands = commands_str.strip().splitlines()
|
commands = commands_str.strip().splitlines()
|
||||||
|
@ -61,9 +60,7 @@ 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:
|
||||||
self.handle_shell_commands(edit[1])
|
self.handle_shell_commands(edit[1])
|
||||||
continue
|
continue
|
||||||
|
@ -86,8 +83,6 @@ class EditBlockCoder(Coder):
|
||||||
else:
|
else:
|
||||||
failed.append(edit)
|
failed.append(edit)
|
||||||
|
|
||||||
dump(failed)
|
|
||||||
dump(passed)
|
|
||||||
if not failed:
|
if not failed:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue