summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJohannes Loher <[email protected]>2026-03-11 19:10:45 +0100
committerGitHub <[email protected]>2026-03-11 13:10:45 -0500
commit2aae0d3493ac51aa2fd3929c6db0814ab795b04b (patch)
tree6b78a053d20164e4c636b357010fd6a6ae166471
parentbcc0d198678f9e88c1868bda2e7f6e54768117fe (diff)
downloadopencode-2aae0d3493ac51aa2fd3929c6db0814ab795b04b.tar.gz
opencode-2aae0d3493ac51aa2fd3929c6db0814ab795b04b.zip
fix(core): read stdout and stderr in PackageRegistry.info before waiting for the process to exit (#16998)
-rw-r--r--packages/opencode/src/bun/registry.ts14
1 files changed, 4 insertions, 10 deletions
diff --git a/packages/opencode/src/bun/registry.ts b/packages/opencode/src/bun/registry.ts
index 1fc853144..e43e20e6c 100644
--- a/packages/opencode/src/bun/registry.ts
+++ b/packages/opencode/src/bun/registry.ts
@@ -1,5 +1,4 @@
import semver from "semver"
-import { text } from "node:stream/consumers"
import { Log } from "../util/log"
import { Process } from "../util/process"
@@ -11,26 +10,21 @@ export namespace PackageRegistry {
}
export async function info(pkg: string, field: string, cwd?: string): Promise<string | null> {
- const result = Process.spawn([which(), "info", pkg, field], {
+ const { code, stdout, stderr } = await Process.run([which(), "info", pkg, field], {
cwd,
- stdout: "pipe",
- stderr: "pipe",
env: {
...process.env,
BUN_BE_BUN: "1",
},
+ nothrow: true,
})
- const code = await result.exited
- const stdout = result.stdout ? await text(result.stdout) : ""
- const stderr = result.stderr ? await text(result.stderr) : ""
-
if (code !== 0) {
- log.warn("bun info failed", { pkg, field, code, stderr })
+ log.warn("bun info failed", { pkg, field, code, stderr: stderr.toString() })
return null
}
- const value = stdout.trim()
+ const value = stdout.toString().trim()
if (!value) return null
return value
}