From ed4213e0226ac8766cab85b1e726d48510e604b5 Mon Sep 17 00:00:00 2001 From: Johannes Loher Date: Wed, 11 Mar 2026 09:28:12 +0100 Subject: [PATCH] fix(core): read stdout and stderr in PackageRegistry.info before waiting for the process to exit The previous implementation waited for the process to exit first, which resulted in empty stdout and stderr. Subsequently, this caused the PackageRegistry.isOutdated check to always return false and log "Failed to resolve latest version, using cached". Fixes #16608 Fixes #10546 Fixes #15673 --- packages/opencode/src/bun/registry.ts | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/packages/opencode/src/bun/registry.ts b/packages/opencode/src/bun/registry.ts index 1fc8531442f..e43e20e6c5a 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 { - 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 }