MCPcopy Index your code
hub / github.com/anomalyco/opencode / which

Function which

packages/core/src/util/which.ts:5–14  ·  view source on GitHub ↗
(cmd: string, env?: NodeJS.ProcessEnv)

Source from the content-addressed store, hash-verified

3import { Global } from "../global"
4
5export function which(cmd: string, env?: NodeJS.ProcessEnv) {
6 const base = env?.PATH ?? env?.Path ?? process.env.PATH ?? process.env.Path ?? ""
7 const full = base ? base + path.delimiter + Global.Path.bin : Global.Path.bin
8 const result = whichPkg.sync(cmd, {
9 nothrow: true,
10 path: full,
11 pathExt: env?.PATHEXT ?? env?.PathExt ?? process.env.PATHEXT ?? process.env.PathExt,
12 })
13 return typeof result === "string" ? result : null
14}

Callers 14

shell.test.tsFile · 0.90
which.test.tsFile · 0.90
fullFunction · 0.90
resolveFunction · 0.90
winFunction · 0.90
gitbashFunction · 0.90
fallbackFunction · 0.90
binary.tsFile · 0.90
spawnFunction · 0.90
getRoslynLanguageServerFunction · 0.90
project.tsFile · 0.90

Calls 1

syncMethod · 0.80

Tested by

no test coverage detected