mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-29 16:54:59 +00:00
fix: Improve error handling in run_interactive_command_pexpect
This commit is contained in:
parent
46ce049777
commit
ec935842ab
1 changed files with 4 additions and 3 deletions
|
@ -17,11 +17,11 @@ IMAGE_EXTENSIONS = {".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".webp"}
|
|||
def run_interactive_command(command):
|
||||
try:
|
||||
import pexpect
|
||||
|
||||
return run_interactive_command_pexpect(command)
|
||||
except ImportError:
|
||||
return run_interactive_command_subprocess(command)
|
||||
|
||||
return run_interactive_command_pexpect(command)
|
||||
|
||||
|
||||
def run_interactive_command_subprocess(command):
|
||||
try:
|
||||
|
@ -46,6 +46,8 @@ def run_interactive_command_pexpect(command):
|
|||
:param command: The command to run as a string.
|
||||
:return: A tuple containing (exit_status, output)
|
||||
"""
|
||||
import pexpect
|
||||
|
||||
output = BytesIO()
|
||||
|
||||
def output_callback(b):
|
||||
|
@ -70,7 +72,6 @@ def run_interactive_command_pexpect(command):
|
|||
|
||||
except pexpect.ExceptionPexpect as e:
|
||||
error_msg = f"Error running command: {e}"
|
||||
print(error_msg, file=sys.stderr)
|
||||
return 1, error_msg
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue