// Verifica disponibilità di binari di sistema invocati via child_process. // Cache in-memory per processo: i binari non vengono installati/disinstallati durante un run. import { spawn } from 'node:child_process'; const cache = new Map(); export async function checkSystemBin(name: string, versionArg = '-version'): Promise { const hit = cache.get(name); if (hit !== undefined) return hit; const ok = await new Promise(resolve => { const p = spawn(name, [versionArg]); p.on('error', () => resolve(false)); p.on('exit', code => resolve(code === 0)); }); if (!ok) console.warn(`[system-bins] '${name}' non trovato su PATH`); cache.set(name, ok); return ok; }