mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-31 09:44:59 +00:00
fix: Use SHELL environment variable in run_interactive_command_pexpect
This commit is contained in:
parent
ec935842ab
commit
6d02c14fe4
1 changed files with 7 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue