diff options
| author | Dax <[email protected]> | 2026-03-19 21:21:55 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-03-19 21:21:55 -0400 |
| commit | 6fcc970def1434b095a20f5e79820fd3894883bd (patch) | |
| tree | 0ca87da637ac53296b87441e84b6f68f62031304 | |
| parent | 52a7a04ad807acc577672f379e8e0cb327602e9d (diff) | |
| download | opencode-6fcc970def1434b095a20f5e79820fd3894883bd.tar.gz opencode-6fcc970def1434b095a20f5e79820fd3894883bd.zip | |
fix: include cache bin directory in which() lookups (#18320)
| -rw-r--r-- | packages/opencode/src/global/index.ts | 2 | ||||
| -rw-r--r-- | packages/opencode/src/util/which.ts | 6 |
2 files changed, 6 insertions, 2 deletions
diff --git a/packages/opencode/src/global/index.ts b/packages/opencode/src/global/index.ts index 2913ac90f..869019e2c 100644 --- a/packages/opencode/src/global/index.ts +++ b/packages/opencode/src/global/index.ts @@ -18,7 +18,7 @@ export namespace Global { return process.env.OPENCODE_TEST_HOME || os.homedir() }, data, - bin: path.join(data, "bin"), + bin: path.join(cache, "bin"), log: path.join(data, "log"), cache, config, diff --git a/packages/opencode/src/util/which.ts b/packages/opencode/src/util/which.ts index 81da25721..2e4073914 100644 --- a/packages/opencode/src/util/which.ts +++ b/packages/opencode/src/util/which.ts @@ -1,9 +1,13 @@ import whichPkg from "which" +import path from "path" +import { Global } from "../global" export function which(cmd: string, env?: NodeJS.ProcessEnv) { + const base = env?.PATH ?? env?.Path ?? process.env.PATH ?? process.env.Path ?? "" + const full = base ? base + path.delimiter + Global.Path.bin : Global.Path.bin const result = whichPkg.sync(cmd, { nothrow: true, - path: env?.PATH ?? env?.Path ?? process.env.PATH ?? process.env.Path, + path: full, pathExt: env?.PATHEXT ?? env?.PathExt ?? process.env.PATHEXT ?? process.env.PathExt, }) return typeof result === "string" ? result : null |
