MCPcopy Index your code
hub / github.com/codeaashu/claude-code / hasCommand

Function hasCommand

src/services/voice.ts:49–61  ·  view source on GitHub ↗
(cmd: string)

Source from the content-addressed store, hash-verified

47// ─── Dependency check ────────────────────────────────────────────────
48
49function hasCommand(cmd: string): boolean {
50 // Spawn the target directly instead of `which cmd`. On Termux/Android
51 // `which` is a shell builtin — the external binary is absent or
52 // kernel-blocked (EPERM) when spawned from Node. Only reached on
53 // non-Windows (win32 returns early from all callers), no PATHEXT issue.
54 // result.error is set iff the spawn itself fails (ENOENT/EACCES); exit
55 // code is irrelevant — an unrecognized --version still means cmd exists.
56 const result = spawnSync(cmd, ['--version'], {
57 stdio: 'ignore',
58 timeout: 3000,
59 })
60 return result.error === undefined
61}
62
63// Probe whether arecord can actually open a capture device. hasCommand()
64// only checks PATH; on WSL1/Win10-WSL2/headless Linux the binary exists

Callers 7

detectPackageManagerFunction · 0.70
checkVoiceDependenciesFunction · 0.70
startRecordingFunction · 0.70
resolveSkillNameFunction · 0.50
PromptInputFunction · 0.50
processSlashCommandFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected