MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / detectFromEnvironment

Function detectFromEnvironment

cli/src/utils/detect-shell.ts:41–58  ·  view source on GitHub ↗
(env: CliEnv)

Source from the content-addressed store, hash-verified

39}
40
41function detectFromEnvironment(env: CliEnv): ShellName | null {
42 const candidates: Array<string | undefined> = []
43
44 if (process.platform === 'win32') {
45 candidates.push(env.COMSPEC, env.SHELL)
46 } else {
47 candidates.push(env.SHELL)
48 }
49
50 for (const candidate of candidates) {
51 const normalized = normalizeCandidate(candidate)
52 if (normalized) {
53 return normalized
54 }
55 }
56
57 return null
58}
59
60function detectViaParentProcessInspection(): ShellName | null {
61 try {

Callers 1

detectShellFunction · 0.85

Calls 1

normalizeCandidateFunction · 0.85

Tested by

no test coverage detected