mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-10 07:11:25 +03:00
fix(cli): prioritize path-matched package manager and extend probe timeout (#54622)
This commit is contained in:
committed by
GitHub
Unverified
parent
ca19780de1
commit
707de58326
@@ -157,7 +157,7 @@ const make = Effect.gen(function* () {
|
||||
return values.findLast((value) => value !== undefined) ?? "notify"
|
||||
})
|
||||
|
||||
const exec = Effect.fnUntraced(function* (command: string[], timeout: Duration.Input = "10 seconds") {
|
||||
const exec = Effect.fnUntraced(function* (command: string[], timeout: Duration.Input = "30 seconds") {
|
||||
return yield* appProcess
|
||||
.run(ChildProcess.make(command[0], command.slice(1)), {
|
||||
timeout,
|
||||
@@ -202,13 +202,15 @@ const make = Effect.gen(function* () {
|
||||
if (installedFormula) return "brew"
|
||||
if (!installedPackage) return
|
||||
|
||||
const checks: ReadonlyArray<{ method: Method; command: string[] }> = [
|
||||
const parts = executable.toLowerCase().split(path.sep).map((part) => part.replace(/^\./, ""))
|
||||
const checks: Array<{ method: Method; command: string[] }> = [
|
||||
{ method: "npm", command: ["npm", "list", "-g", "--depth=0", installedPackage] },
|
||||
{ method: "pnpm", command: ["pnpm", "list", "-g", "--depth=0", installedPackage] },
|
||||
{ method: "bun", command: ["bun", "pm", "ls", "-g"] },
|
||||
{ method: "yarn", command: ["yarn", "global", "list"] },
|
||||
{ method: "vp", command: ["vp", "list", "-g", "--json", installedPackage] },
|
||||
]
|
||||
checks.sort((a, b) => Number(parts.includes(b.method)) - Number(parts.includes(a.method)))
|
||||
const results = yield* Effect.forEach(
|
||||
checks,
|
||||
(check) =>
|
||||
|
||||
Reference in New Issue
Block a user