From 6d02c14fe4509a0b20a945941fc69037ab17928d Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Tue, 27 Aug 2024 09:09:25 -0700 Subject: [PATCH] fix: Use SHELL environment variable in run_interactive_command_pexpect --- aider/utils.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/aider/utils.py b/aider/utils.py index ff296492c..d9119b241 100644 --- a/aider/utils.py +++ b/aider/utils.py @@ -55,12 +55,14 @@ def run_interactive_command_pexpect(command): return b try: - # Check if /bin/sh exists - if os.path.exists("/bin/sh"): - # Use /bin/sh -c if it exists - child = pexpect.spawn("/bin/sh", args=["-c", command], encoding="utf-8") + # Use the SHELL environment variable, falling back to /bin/sh if not set + shell = os.environ.get('SHELL', '/bin/sh') + + if os.path.exists(shell): + # Use the shell from SHELL environment variable + child = pexpect.spawn(shell, args=["-c", command], encoding="utf-8") else: - # Fall back to the original behavior + # Fall back to spawning the command directly child = pexpect.spawn(command, encoding="utf-8") # Transfer control to the user, capturing output