(binary: string)
| 51 | * Uses centralized subprocess runner to respect user-configured env vars (e.g., custom PATH) |
| 52 | */ |
| 53 | export async function checkRuntimeBinary(binary: string): Promise<BinaryCheckResult> { |
| 54 | const platform = process.platform |
| 55 | const whichCommand = platform === "win32" ? "where" : "which" |
| 56 | |
| 57 | const result = await execCommand(whichCommand, [binary], { timeout: 5000 }) |
| 58 | |
| 59 | if (result.success) { |
| 60 | const binaryPath = result.stdout.trim().split("\n")[0] // Take first result on Windows (where returns multiple) |
| 61 | return { |
| 62 | installed: true, |
| 63 | path: binaryPath, |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | return { |
| 68 | installed: false, |
| 69 | error: result.stderr || "Binary not found", |
| 70 | } |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * Check if the managed ripgrep binary is present and functional. |
no test coverage detected