(cmd: string)
| 75 | // ─── Dependency check ──────────────────────────────────────────────── |
| 76 | |
| 77 | function hasCommand(cmd: string): boolean { |
| 78 | // Spawn the target directly instead of `which cmd`. On Termux/Android |
| 79 | // `which` is a shell builtin — the external binary is absent or |
| 80 | // kernel-blocked (EPERM) when spawned from Node. Only reached on |
| 81 | // non-Windows (win32 returns early from all callers), no PATHEXT issue. |
| 82 | // result.error is set iff the spawn itself fails (ENOENT/EACCES); exit |
| 83 | // code is irrelevant — an unrecognized --version still means cmd exists. |
| 84 | const result = spawnSync(cmd, ['--version'], { |
| 85 | stdio: 'ignore', |
| 86 | timeout: 3000, |
| 87 | }) |
| 88 | return result.error === undefined |
| 89 | } |
| 90 | |
| 91 | // Probe whether arecord can actually open a capture device. hasCommand() |
| 92 | // only checks PATH; on WSL1/Win10-WSL2/headless Linux the binary exists |
no outgoing calls
no test coverage detected