Repository navigation
hotfix(install.sh): two Windows fresh-install regressions (#249) - #265
Conversation
There was a problem hiding this comment.
Pull request overview
Fixes two Windows fresh-install regressions in install.sh that were blocking clean curl install.sh | bash flows and native PowerShell usage.
Changes:
- Stage
install-elevated.ps1in a temp directory instead of$CLONE_DIRto keep thegit clonedestination empty on first install. - On Windows (MINGW/MSYS/Cygwin), copy
airc.cmdandairc.ps1into$BIN_DIRso native PowerShell/cmd.exe resolve to the proper shims.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Windows: also place airc.cmd + airc.ps1 forwarders on PATH. | ||
| # Without these, `airc` invoked from native PowerShell or cmd.exe | ||
| # resolves to the bash script, which PowerShell can't execute | ||
| # ("Cannot run a document in the middle of a pipeline"). PR #262 | ||
| # made airc.ps1 a thin forwarder to bash, but that's moot if the | ||
| # .ps1 isn't on PATH. cp (not ln -sf) — Windows symlinks are |
There was a problem hiding this comment.
The comment says “PR #262 made airc.ps1 a thin forwarder to bash”, but in this branch airc.ps1 is still the full Windows-native port (#Requires -Version 7.0, ~3k lines). This makes the inline rationale misleading; suggest rewording to be accurate regardless of whether airc.ps1 is a forwarder or a full implementation (e.g., just state that the .cmd/.ps1 shims must be on PATH for PowerShell/cmd.exe).
| # Windows: also place airc.cmd + airc.ps1 forwarders on PATH. | |
| # Without these, `airc` invoked from native PowerShell or cmd.exe | |
| # resolves to the bash script, which PowerShell can't execute | |
| # ("Cannot run a document in the middle of a pipeline"). PR #262 | |
| # made airc.ps1 a thin forwarder to bash, but that's moot if the | |
| # .ps1 isn't on PATH. cp (not ln -sf) — Windows symlinks are | |
| # Windows: also place airc.cmd + airc.ps1 shims on PATH. | |
| # Without these, `airc` invoked from native PowerShell or cmd.exe | |
| # resolves to the bash script, which PowerShell can't execute | |
| # ("Cannot run a document in the middle of a pipeline"). The | |
| # .cmd/.ps1 entrypoints must be on PATH for native PowerShell/cmd.exe | |
| # use, regardless of whether airc.ps1 is a forwarder or a full | |
| # implementation. cp (not ln -sf) — Windows symlinks are |
| # privileged + flaky; copying is universal. Caught by | ||
| # continuum-b69f 2026-04-29 (issue #249 PowerShell row). | ||
| case "$(uname -s 2>/dev/null)" in | ||
| MINGW*|MSYS*|CYGWIN*) |
There was a problem hiding this comment.
This change makes native PowerShell/cmd.exe invocations hit airc.cmd, but airc.cmd currently hard-requires pwsh (PowerShell 7+) and install.sh doesn’t appear to install or verify pwsh on Windows Git Bash. Consider adding an explicit check here that pwsh is available (and emit a clear install hint / auto-install via winget), otherwise users may still be blocked with a confusing “pwsh not recognized” error.
| MINGW*|MSYS*|CYGWIN*) | |
| MINGW*|MSYS*|CYGWIN*) | |
| if ! command -v pwsh >/dev/null 2>&1; then | |
| warn "Native Windows airc launchers require PowerShell 7+ ('pwsh'), but it was not found on PATH." | |
| if command -v winget >/dev/null 2>&1; then | |
| warn "Install it with: winget install --id Microsoft.PowerShell --source winget" | |
| else | |
| warn "Install PowerShell 7+ from https://aka.ms/powershell-release?tag=stable and re-run this installer." | |
| fi | |
| warn "Re-run install.sh after 'pwsh' is available so airc.cmd/airc.ps1 work from cmd.exe and PowerShell." | |
| exit 1 | |
| fi |
a4fde2e to
204086e
Compare
Caught by continuum-b69f's wipe-and-reinstall test for the #249 release-readiness matrix (Windows Git Bash + PowerShell rows). ## Bug 1: install-elevated.ps1 staged in $CLONE_DIR before git clone `_ensure_sshd_running` runs from `ensure_prereqs` (line 747/789), which mkdir's $CLONE_DIR and writes install-elevated.ps1 to it BEFORE the git clone step (line 872). Result on a fresh-install user (no existing ~/.airc-src): fatal: destination path 'C:/Users/green/.airc-src' already exists and is not an empty directory. Hostile error, no recovery hint. Workaround was AIRC_SKIP_PREREQS=1. Fix: stage the .ps1 in $TMPDIR instead. The .ps1 is consumed by the elevated PowerShell process (which reads from $env:TEMP via the log-write Path); its location during install is irrelevant. ## Bug 2: airc.cmd + airc.ps1 forwarders not placed on PATH install.sh's symlink step (line 881-884) only ln -sf'd the bash `airc`, leaving airc.cmd and airc.ps1 in $CLONE_DIR but not on PATH. Result: native PowerShell `airc` resolves to the bash script, which PowerShell can't execute: PS> airc version Cannot run a document in the middle of a pipeline: C:\Users\green\.local\bin\airc. PR #262's collapse of airc.ps1 to a thin forwarder is moot if the forwarder isn't reachable. Fix: on MINGW*/MSYS*/CYGWIN*, `cp -f` airc.cmd + airc.ps1 to $BIN_DIR. cp not ln -sf — Windows symlinks need elevation, copying is universal and the forwarders are tiny.
204086e to
bee65c4
Compare
Summary
Two real regressions blocking fresh
curl install.sh | bashon Windows. Both caught by continuum-b69f's wipe-and-reinstall test for the #249 release-readiness matrix.Bug 1 —
install-elevated.ps1staged in$CLONE_DIRbeforegit clone_ensure_sshd_runningmkdir's$CLONE_DIRand writesinstall-elevated.ps1there BEFORE the git clone step. Result for a fresh-install user (no existing~/.airc-src):Hostile error, no recovery hint. Workaround was
AIRC_SKIP_PREREQS=1.Fix: stage
install-elevated.ps1in$TMPDIRinstead. The .ps1 is consumed by the elevated PowerShell process which reads its log path via$env:TEMPdirectly — its install-time location is irrelevant.Bug 2 —
airc.cmd+airc.ps1forwarders not on PATHinstall.sh's symlink step only
ln -sf'd the bashairc.airc.cmdandairc.ps1exist in$CLONE_DIRbut aren't on$BIN_DIR. Native PowerShellaircthen resolves to the bash script:PR #262's PowerShell forwarder is moot if PowerShell can't find it.
Fix: on
MINGW*/MSYS*/CYGWIN*,cp -f airc.cmd airc.ps1 → $BIN_DIR/.cpnotln -sf— Windows symlinks need elevation and the forwarders are tiny.Test plan
airc versionresolves through the .ps1 forwarder.🤖 Generated with Claude Code