Dax Raad 8 bulan lalu
induk
melakukan
1bcc02442a

+ 5 - 3
packages/opencode/src/bun/index.ts

@@ -3,7 +3,7 @@ import { Log } from "../util/log"
 export namespace BunProc {
 export namespace BunProc {
   const log = Log.create({ service: "bun" })
   const log = Log.create({ service: "bun" })
 
 
-  export function run(
+  export async function run(
     cmd: string[],
     cmd: string[],
     options?: Bun.SpawnOptions.OptionsObject<any, any, any>,
     options?: Bun.SpawnOptions.OptionsObject<any, any, any>,
   ) {
   ) {
@@ -15,15 +15,17 @@ export namespace BunProc {
       cmd: [root, ...cmd],
       cmd: [root, ...cmd],
       options,
       options,
     })
     })
-    const result = Bun.spawnSync([root, ...cmd], {
+    const result = Bun.spawn([root, ...cmd], {
       ...options,
       ...options,
       argv0: "bun",
       argv0: "bun",
       env: {
       env: {
         ...process.env,
         ...process.env,
         ...options?.env,
         ...options?.env,
+        BUN_BE_BUN: "1",
       },
       },
     })
     })
-    if (result.exitCode !== 0) {
+    const code = await result.exited
+    if (code !== 0) {
       console.error(result.stderr?.toString("utf8") ?? "")
       console.error(result.stderr?.toString("utf8") ?? "")
       throw new Error(`Command failed with exit code ${result.exitCode}`)
       throw new Error(`Command failed with exit code ${result.exitCode}`)
     }
     }

+ 1 - 1
packages/opencode/src/provider/provider.ts

@@ -161,7 +161,7 @@ export namespace Provider {
       log.info("installing", {
       log.info("installing", {
         providerID,
         providerID,
       })
       })
-      BunProc.run(["add", `@ai-sdk/${providerID}@alpha`], {
+      await BunProc.run(["add", `@ai-sdk/${providerID}@alpha`], {
         cwd: Global.Path.cache,
         cwd: Global.Path.cache,
       })
       })
     }
     }