diff --git a/third_party/pi/packages/coding-agent/src/utils/tools-manager.ts b/third_party/pi/packages/coding-agent/src/utils/tools-manager.ts index f040f52..2bcca47 100644 --- a/third_party/pi/packages/coding-agent/src/utils/tools-manager.ts +++ b/third_party/pi/packages/coding-agent/src/utils/tools-manager.ts @@ -72,8 +72,8 @@ const TOOLS: Record = { function commandExists(cmd: string): boolean { try { const result = spawnSync(cmd, ["--version"], { stdio: "pipe" }); - // Check for ENOENT error (command not found) - return result.error === undefined || result.error === null; + // Downloaded generic Linux binaries can exist but fail on NixOS before they print a version. + return (result.error === undefined || result.error === null) && result.status === 0; } catch { return false; } @@ -86,7 +86,7 @@ export function getToolPath(tool: "fd" | "rg"): string | null { // Check our tools directory first const localPath = join(TOOLS_DIR, config.binaryName + (platform() === "win32" ? ".exe" : "")); - if (existsSync(localPath)) { + if (existsSync(localPath) && commandExists(localPath)) { return localPath; }