From 0197853c3914aa9accded1284c84dc088fa6ef3f Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Tue, 27 Aug 2024 08:52:54 -0700 Subject: [PATCH] style: Run linter on utils.py --- aider/utils.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/aider/utils.py b/aider/utils.py index 39e2cab5e..0bbe86ea5 100644 --- a/aider/utils.py +++ b/aider/utils.py @@ -4,20 +4,21 @@ import subprocess import sys import tempfile import time -from pathlib import Path -import pexpect from io import BytesIO +from pathlib import Path import git +import pexpect from aider.dump import dump # noqa: F401 IMAGE_EXTENSIONS = {".png", ".jpg", ".jpeg", ".gif", ".bmp", ".tiff", ".webp"} + def run_interactive_command(command): """ Run a shell command interactively using pexpect, capturing all output. - + :param command: The command to run as a string. :return: A tuple containing (exit_status, output) """ @@ -30,14 +31,14 @@ def run_interactive_command(command): try: # Spawn the command child = pexpect.spawn(command, encoding=None) - + # Transfer control to the user, capturing output child.interact(output_filter=output_callback) - + # Wait for the command to finish and get the exit status child.close() - return child.exitstatus, output.getvalue().decode('utf-8', errors='replace') - + return child.exitstatus, output.getvalue().decode("utf-8", errors="replace") + except pexpect.ExceptionPexpect as e: error_msg = f"Error running command: {e}" print(error_msg, file=sys.stderr)