From dd9ba80605cdd3dcd2f5458ad9f853add21ab1a5 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 9 Jun 2026 14:12:05 +0000 Subject: [PATCH] fix: add 3s timeout to container runtime detection in detectContainerRuntime Without a timeout, docker/podman info can hang indefinitely when the daemon is unresponsive, causing `sonar system status` to time out. spawnProcessWithTimeout already exists for this purpose. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- src/lib/tool-detector.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/lib/tool-detector.ts b/src/lib/tool-detector.ts index 308607c62..9246b2131 100644 --- a/src/lib/tool-detector.ts +++ b/src/lib/tool-detector.ts @@ -20,14 +20,22 @@ // Tool detector - checks presence and availability of system tools -import { spawnProcess } from './process'; +import { spawnProcessWithTimeout } from './process'; const CONTAINER_RUNTIMES = ['docker', 'podman', 'nerdctl'] as const; export type ContainerRuntime = (typeof CONTAINER_RUNTIMES)[number]; +const RUNTIME_DETECTION_TIMEOUT_MS = 3000; + async function isRuntimeAvailable(runtime: ContainerRuntime): Promise { try { - const result = await spawnProcess(runtime, ['info']); + const result = await spawnProcessWithTimeout( + runtime, + ['info'], + {}, + RUNTIME_DETECTION_TIMEOUT_MS, + `${runtime} info timed out`, + ); return result.exitCode === 0; } catch { return false;