Parcourir la source

core: use --no-cache when behind proxy to avoid hangs

Aiden Cline il y a 1 mois
Parent
commit
8ebc601ea2
1 fichiers modifiés avec 17 ajouts et 1 suppressions
  1. 17 1
      packages/opencode/src/bun/index.ts

+ 17 - 1
packages/opencode/src/bun/index.ts

@@ -73,8 +73,24 @@ export namespace BunProc {
     })
     if (parsed.dependencies[pkg] === version) return mod
 
+    const proxied = !!(
+      process.env.HTTP_PROXY ||
+      process.env.HTTPS_PROXY ||
+      process.env.http_proxy ||
+      process.env.https_proxy
+    )
+
     // Build command arguments
-    const args = ["add", "--force", "--exact", "--cwd", Global.Path.cache, pkg + "@" + version]
+    const args = [
+      "add",
+      "--force",
+      "--exact",
+      // TODO: get rid of this case (see: https://github.com/oven-sh/bun/issues/19936)
+      ...(proxied ? ["--no-cache"] : []),
+      "--cwd",
+      Global.Path.cache,
+      pkg + "@" + version,
+    ]
 
     // Let Bun handle registry resolution:
     // - If .npmrc files exist, Bun will use them automatically