Skip to content

hotfix(install.sh): two Windows fresh-install regressions (#249) - #265

Merged
joelteply merged 2 commits into
canaryfrom
fix/install-windows-fresh-install-regressions
Apr 29, 2026
Merged

joelteply merged 2 commits into
canaryfrom
fix/install-windows-fresh-install-regressions

Conversation

@joelteply

Copy link
Copy Markdown
Contributor

Summary

Two real regressions blocking fresh curl install.sh | bash on Windows. Both caught by continuum-b69f's wipe-and-reinstall test for the #249 release-readiness matrix.

Bug 1 — install-elevated.ps1 staged in $CLONE_DIR before git clone

_ensure_sshd_running mkdir's $CLONE_DIR and writes install-elevated.ps1 there BEFORE the git clone step. Result for 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 install-elevated.ps1 in $TMPDIR instead. The .ps1 is consumed by the elevated PowerShell process which reads its log path via $env:TEMP directly — its install-time location is irrelevant.

Bug 2 — airc.cmd + airc.ps1 forwarders not on PATH

install.sh's symlink step only ln -sf'd the bash airc. airc.cmd and airc.ps1 exist in $CLONE_DIR but aren't on $BIN_DIR. Native PowerShell airc then resolves to the bash script:

PS> airc version
Cannot run a document in the middle of a pipeline: C:\Users\green\.local\bin\airc.

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/. cp not ln -sf — Windows symlinks need elevation and the forwarders are tiny.

Test plan

  • Verified locally on continuum-b69f Windows MINGW64: pre-fix, fresh install fails on git clone; post-fix, fresh install completes cleanly + PowerShell airc version resolves through the .ps1 forwarder.
  • CI clean-install jobs (Linux/macOS/Windows-bash/Windows-PS5) — should all stay green; Linux/Mac don't enter the new branch, Windows now picks up the .cmd+.ps1.

🤖 Generated with Claude Code

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ps1 in a temp directory instead of $CLONE_DIR to keep the git clone destination empty on first install.
  • On Windows (MINGW/MSYS/Cygwin), copy airc.cmd and airc.ps1 into $BIN_DIR so native PowerShell/cmd.exe resolve to the proper shims.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread install.sh
Comment on lines +894 to +899
# 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

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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).

Suggested change
# 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

Copilot uses AI. Check for mistakes.
Comment thread install.sh
# 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*)

Copilot AI Apr 29, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
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

Copilot uses AI. Check for mistakes.
@joelteply
joelteply force-pushed the fix/install-windows-fresh-install-regressions branch from a4fde2e to 204086e Compare April 29, 2026 01:07
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.
@joelteply
joelteply force-pushed the fix/install-windows-fresh-install-regressions branch from 204086e to bee65c4 Compare April 29, 2026 01:09
@joelteply
joelteply changed the base branch from main to canary April 29, 2026 01:09
@joelteply joelteply changed the title fix(install.sh): two Windows fresh-install regressions (#249) hotfix(install.sh): two Windows fresh-install regressions (#249) Apr 29, 2026
@joelteply
joelteply merged commit d6b27e1 into canary Apr 29, 2026
6 checks passed
@joelteply
joelteply deleted the fix/install-windows-fresh-install-regressions branch April 29, 2026 01:15
joelteply added a commit that referenced this pull request Apr 29, 2026