Skip to content

Fix Windows ACP install: spawn powershell.exe directly instead of via bash#2832

Closed
h4root wants to merge 1 commit into
block:mainfrom
h4root:fix/windows-acp-powershell-install
Closed

Fix Windows ACP install: spawn powershell.exe directly instead of via bash#2832
h4root wants to merge 1 commit into
block:mainfrom
h4root:fix/windows-acp-powershell-install

Conversation

@h4root

@h4root h4root commented Jul 25, 2026

Copy link
Copy Markdown

Fixes #2401, fixes #2407.

Problem

On Windows, the CLI install commands for the Claude and Codex ACP runtimes are PowerShell one-liners (see managed_agents/discovery.rs):

powershell.exe -NoProfile -ExecutionPolicy Bypass -Command "irm https://claude.ai/install.ps1 | iex"

run_install_command currently wraps every install command in bash -l -c "..." via install_shell_command. This has two consequences on Windows:

  1. Broken nested quoting — the inner double quotes around the -Command argument collide with the outer bash -c "..." quoting, so the PowerShell one-liner is mangled.
  2. Git Bash required to install the CLIresolve_install_shell returns GIT_BASH_INSTALL_HINT (no suitable shell found) when Git Bash is absent, so the user cannot install the Claude/Codex CLI at all until they first install Git Bash.

The bash -l login-shell startup also reads the user's full profile (nvm/conda/etc.), which is what produced the "took 45 minutes" report in #2401 before the 5-minute timeout killed it.

Fix

Add build_install_command, which on Windows detects powershell.exe ... commands and spawns powershell.exe directly (with CREATE_NO_WINDOW), bypassing Git Bash for that step. Everything else — the npm adapter installs, all Unix — continues through the existing install_shell_command path unchanged.

  • PowerShell CLI installs no longer need Git Bash and no longer pay the bash -l startup cost.
  • #[cfg(windows)] gates the whole addition, so macOS/Linux behavior is untouched.
  • Unit tests cover detection (PowerShell yes; npm / curl-pipe-bash no; case-insensitive).

On Windows, CLI install commands for Claude and Codex are PowerShell
one-liners. Wrapping them in `bash -l -c "..."` breaks nested quoting
in the -Command argument and requires Git Bash to be present before
the CLI itself is installed.

Add `build_install_command` which detects `powershell.exe ...` commands
and spawns them directly via `powershell.exe`, bypassing Git Bash for
that step. npm adapter commands continue through the existing bash path.

This also eliminates the `bash -l` login-shell startup overhead that
caused installs to hang for 45+ minutes on some Windows machines.

Fixes block#2401, fixes block#2407
@h4root
h4root requested a review from a team as a code owner July 25, 2026 10:28
@h4root

h4root commented Jul 25, 2026

Copy link
Copy Markdown
Author

Closing — this is already fixed upstream in #2680 (is_powershell_command / install_powershell_command). This branch was based on a stale main and reimplements the same fix, less completely. Apologies for the noise.

@h4root h4root closed this Jul 25, 2026
@h4root
h4root deleted the fix/windows-acp-powershell-install branch July 25, 2026 10:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant