summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-06-24 14:33:35 -0400
committerDax Raad <[email protected]>2025-06-24 14:33:35 -0400
commit9dc00edfc965b682b0f8ad349245c4a61df22663 (patch)
tree933fa43d392647123c22d4b3d072abe2e7be26f1
parente063bf888ed4c5d6cda8864e56e822694b2499dc (diff)
downloadopencode-9dc00edfc965b682b0f8ad349245c4a61df22663.tar.gz
opencode-9dc00edfc965b682b0f8ad349245c4a61df22663.zip
potential fix for failing to install provider package on first run
-rw-r--r--packages/opencode/src/bun/index.ts22
1 files changed, 13 insertions, 9 deletions
diff --git a/packages/opencode/src/bun/index.ts b/packages/opencode/src/bun/index.ts
index e3316eaae..927c23bf6 100644
--- a/packages/opencode/src/bun/index.ts
+++ b/packages/opencode/src/bun/index.ts
@@ -13,9 +13,9 @@ export namespace BunProc {
) {
log.info("running", {
cmd: [which(), ...cmd],
- options,
+ ...options,
})
- const result = Bun.spawn([which(), ...cmd], {
+ const result = Bun.spawnSync([which(), ...cmd], {
...options,
stdout: "pipe",
stderr: "pipe",
@@ -25,7 +25,14 @@ export namespace BunProc {
BUN_BE_BUN: "1",
},
})
- const code = await result.exited
+ const stdout = result.stdout!.toString()
+ const stderr = result.stderr!.toString()
+ const code = result.exitCode
+ log.info("done", {
+ code,
+ stdout,
+ stderr,
+ })
if (code !== 0) {
throw new Error(`Command failed with exit code ${result.exitCode}`)
}
@@ -53,12 +60,9 @@ export namespace BunProc {
if (parsed.dependencies[pkg] === version) return mod
parsed.dependencies[pkg] = version
await Bun.write(pkgjson, JSON.stringify(parsed, null, 2))
- await BunProc.run(
- ["install", "--registry", "https://registry.npmjs.org/"],
- {
- cwd: Global.Path.cache,
- },
- ).catch((e) => {
+ await BunProc.run(["install", "--registry=https://registry.npmjs.org"], {
+ cwd: Global.Path.cache,
+ }).catch((e) => {
new InstallFailedError(
{ pkg, version },
{