Skip to content

fix(windows): use cross-spawn for shim-backed commands - #18010

Merged
Hona merged 12 commits into
anomalyco:devfrom
Hona:fix/shell-passthru-on-win32
Mar 18, 2026
Merged

fix(windows): use cross-spawn for shim-backed commands#18010
Hona merged 12 commits into
anomalyco:devfrom
Hona:fix/shell-passthru-on-win32

Conversation

@Hona

@Hona Hona commented Mar 17, 2026

Copy link
Copy Markdown
Member

The pain

  • Windows shim-backed commands (.cmd / .bat) were failing across upgrade, uninstall, PR handoff, IDE install, and LSP launch.
  • shell: true papers over that, but it adds quoting and process-lifecycle problems.

The solution

  • Use cross-spawn in packages/opencode/src/util/process.ts for normal argv launches.
  • Keep shell usage explicit.
  • Route LSP launches through the shared process path and keep Process.stop(...) for Windows teardown.

Why it works

  • cross-spawn handles Windows shim resolution and quoting without forcing shell semantics.
  • Built-in and configured LSP commands now launch the same way.

Fixes

Copilot AI review requested due to automatic review settings March 17, 2026 23:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Routes Windows install detection and package-manager upgrade commands through a shell so .cmd/.bat shims resolve correctly, and improves visibility into npm-registry update checks via additional logging.

Changes:

  • Forward shell through Process.run() so Process.text()/Process.run() behave consistently when shell execution is required.
  • On Windows, run install-method detection and upgrade commands with shell: true for npm/pnpm/bun/choco/scoop.
  • Add info/error logging around npm-registry “latest version” lookups (including request URL and failure details).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
packages/opencode/src/util/process.ts Passes opts.shell from Process.run() down to spawn() so callers can reliably enable shell execution.
packages/opencode/src/installation/index.ts Enables shell routing on Windows for detection/upgrades and adds registry lookup logging for update checks.

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

Comment thread packages/opencode/src/util/process.ts
Comment thread packages/opencode/src/installation/index.ts
Comment thread packages/opencode/src/installation/index.ts Outdated
@Hona Hona changed the title fix(cli): route Windows upgrade commands through shell fix(windows): route shell-backed commands through shell Mar 18, 2026
@Hona Hona changed the title fix(windows): route shell-backed commands through shell fix(windows): use cross-spawn for shim-backed commands Mar 18, 2026
@Hona
Hona merged commit 54ed87d into anomalyco:dev Mar 18, 2026
9 checks passed
AvatarGanymede pushed a commit to AvatarGanymede/opencode-dev that referenced this pull request Mar 19, 2026
demostanis pushed a commit to demostanis/opencode that referenced this pull request Mar 19, 2026
raf1hh pushed a commit to raf1hh/opencode that referenced this pull request Mar 20, 2026
demostanis pushed a commit to demostanis/opencode that referenced this pull request Mar 20, 2026
balcsida pushed a commit to balcsida/opencode that referenced this pull request Apr 8, 2026
xywsxp pushed a commit to xywsxp/opencode that referenced this pull request Apr 24, 2026
Rwanbt pushed a commit to Rwanbt/unifia that referenced this pull request May 5, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
AIALRA-0 pushed a commit to AIALRA-0/opencode-turn-engine that referenced this pull request Jun 10, 2026
avion23 pushed a commit to avion23/opencode that referenced this pull request Jun 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants