import { execFile } from "node:child_process"; import { promisify } from "node:util"; const execFileAsync = promisify(execFile); export async function checkSystemCommand(command: string): Promise { try { if (process.platform === "win32") { await execFileAsync("where", [command], { timeout: 5000 }); } else { await execFileAsync("which", [command], { timeout: 5000 }); } return true; } catch { return false; } } export async function execResolved( binary: string, args: string[], options: { timeout?: number; signal?: AbortSignal } = {}, ) { const { timeout = 30000, signal } = options; return execFileAsync(binary, args, { timeout, maxBuffer: 10 * 1024 * 1024, signal }); }