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

This commit is contained in:
Luke Parker
2026-03-19 08:49:16 +10:00
committed by GitHub
parent 8ee939c741
commit 54ed87d53c
11 changed files with 126 additions and 38 deletions

View File

@@ -1,9 +1,9 @@
import { BusEvent } from "@/bus/bus-event"
import { Bus } from "@/bus"
import { spawn } from "bun"
import z from "zod"
import { NamedError } from "@opencode-ai/util/error"
import { Log } from "../util/log"
import { Process } from "@/util/process"
const SUPPORTED_IDES = [
{ name: "Windsurf" as const, cmd: "windsurf" },
@@ -52,13 +52,11 @@ export namespace Ide {
const cmd = SUPPORTED_IDES.find((i) => i.name === ide)?.cmd
if (!cmd) throw new Error(`Unknown IDE: ${ide}`)
const p = spawn([cmd, "--install-extension", "sst-dev.opencode"], {
stdout: "pipe",
stderr: "pipe",
const p = await Process.run([cmd, "--install-extension", "sst-dev.opencode"], {
nothrow: true,
})
await p.exited
const stdout = await new Response(p.stdout).text()
const stderr = await new Response(p.stderr).text()
const stdout = p.stdout.toString()
const stderr = p.stderr.toString()
log.info("installed", {
ide,
@@ -66,7 +64,7 @@ export namespace Ide {
stderr,
})
if (p.exitCode !== 0) {
if (p.code !== 0) {
throw new InstallFailedError({ stderr })
}
if (stdout.includes("already installed")) {