(cmd: string)
| 47 | // ─── Dependency check ──────────────────────────────────────────────── |
| 48 | |
| 49 | function 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 |
no outgoing calls
no test coverage detected