INNER CODE UNIT · TypeScript
toolExists
1095071913/maozi-cloud · maozi-cloud-develop-admin/electron/configs/index.ts:26
async function toolExists(type: Exclude<ConfigType, ''>): Promise<boolean> {
const cached = toolCache[type]
if (cached && Date.now() - cached.at < TOOL_CACHE_MS) return cached.ok
let ok = false
try {
const pathEnv = await getShellPath()
await exec('which', [TOOL_BIN[type]], { timeout: 8000, env: { ...process.env, PATH: pathEnv } })
ok = true
} catch {
ok = false
}
toolCache[type] = { ok, at: Date.now() }
return ok
}
async function checkTools(): Promise<ToolAvailability> {
const [git, docker, helm, linux] = await Promise.all([
toolExists('Git'),