From 2bda5e9a83c237e178b6eba5e427f4b4f8e66a1e Mon Sep 17 00:00:00 2001 From: James Williams Date: Wed, 22 Oct 2025 13:45:01 -0700 Subject: [PATCH 1/4] Recognize pwsh.exe as a valid parent process on Windows. --- aider/run_cmd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/run_cmd.py b/aider/run_cmd.py index f201b41dcc6..36bc5745ead 100644 --- a/aider/run_cmd.py +++ b/aider/run_cmd.py @@ -31,7 +31,7 @@ def get_windows_parent_process_name(): if parent is None: break parent_name = parent.name().lower() - if parent_name in ["powershell.exe", "cmd.exe"]: + if parent_name in ["pwsh.exe", "powershell.exe", "cmd.exe"]: return parent_name current_process = parent return None @@ -50,7 +50,7 @@ def run_cmd_subprocess(command, verbose=False, cwd=None, encoding=sys.stdout.enc # Determine the appropriate shell if platform.system() == "Windows": parent_process = get_windows_parent_process_name() - if parent_process == "powershell.exe": + if parent_process in ["pwsh.exe", "powershell.exe"]: command = f"powershell -Command {command}" if verbose: From 56ff50034f16492bf2d78c866d337903f8278405 Mon Sep 17 00:00:00 2001 From: James Williams Date: Wed, 22 Oct 2025 14:21:25 -0700 Subject: [PATCH 2/4] Replace shlex.join with simple join. --- aider/tools/grep.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/aider/tools/grep.py b/aider/tools/grep.py index e28936ef14e..f55401489f7 100644 --- a/aider/tools/grep.py +++ b/aider/tools/grep.py @@ -1,4 +1,3 @@ -import shlex import shutil from pathlib import Path @@ -117,7 +116,7 @@ def _execute_grep( cmd_args.extend([pattern, str(search_dir_path)]) # Convert list to command string for run_cmd_subprocess - command_string = shlex.join(cmd_args) + command_string = " ".join(cmd_args) coder.io.tool_output(f"⚙️ Executing {tool_name}: {command_string}") From 60f05fd85c0d873a40cbee5dd4b2ddbb0e2d1480 Mon Sep 17 00:00:00 2001 From: James Williams Date: Thu, 23 Oct 2025 08:18:55 -0700 Subject: [PATCH 3/4] Use oslex instead of shlex. --- aider/tools/grep.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/aider/tools/grep.py b/aider/tools/grep.py index f55401489f7..43a86e6ac83 100644 --- a/aider/tools/grep.py +++ b/aider/tools/grep.py @@ -1,6 +1,8 @@ import shutil from pathlib import Path +import oslex + from aider.run_cmd import run_cmd_subprocess @@ -116,7 +118,7 @@ def _execute_grep( cmd_args.extend([pattern, str(search_dir_path)]) # Convert list to command string for run_cmd_subprocess - command_string = " ".join(cmd_args) + command_string = oslex.join(cmd_args) coder.io.tool_output(f"⚙️ Executing {tool_name}: {command_string}") From 18f80fb378ec89999d76ec4be1d880eabf867368 Mon Sep 17 00:00:00 2001 From: James Williams Date: Thu, 23 Oct 2025 20:44:07 -0700 Subject: [PATCH 4/4] Revert "Recognize pwsh.exe as a valid parent process on Windows." This reverts commit 2bda5e9a83c237e178b6eba5e427f4b4f8e66a1e. --- aider/run_cmd.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aider/run_cmd.py b/aider/run_cmd.py index 36bc5745ead..f201b41dcc6 100644 --- a/aider/run_cmd.py +++ b/aider/run_cmd.py @@ -31,7 +31,7 @@ def get_windows_parent_process_name(): if parent is None: break parent_name = parent.name().lower() - if parent_name in ["pwsh.exe", "powershell.exe", "cmd.exe"]: + if parent_name in ["powershell.exe", "cmd.exe"]: return parent_name current_process = parent return None @@ -50,7 +50,7 @@ def run_cmd_subprocess(command, verbose=False, cwd=None, encoding=sys.stdout.enc # Determine the appropriate shell if platform.system() == "Windows": parent_process = get_windows_parent_process_name() - if parent_process in ["pwsh.exe", "powershell.exe"]: + if parent_process == "powershell.exe": command = f"powershell -Command {command}" if verbose: