fix(gbrain): probe CLI without command builtin

This commit is contained in:
Jayesh Betala
2026-05-16 21:00:32 +05:30
committed by Garry Tan
parent cfd2b5d792
commit f8e4291521
6 changed files with 29 additions and 18 deletions
+3 -4
View File
@@ -101,13 +101,13 @@ export function resolveGbrainBin(env?: NodeJS.ProcessEnv): string | null {
if (_gbrainBinCache.has(key)) return _gbrainBinCache.get(key)!;
let result: string | null = null;
try {
const out = execFileSync("sh", ["-c", "command -v gbrain"], {
execFileSync("gbrain", ["--version"], {
encoding: "utf-8",
timeout: 2_000,
stdio: ["ignore", "pipe", "ignore"],
stdio: ["ignore", "ignore", "ignore"],
env: e,
});
result = out.trim() || null;
result = "gbrain";
} catch {
result = null;
}
@@ -266,4 +266,3 @@ export function localEngineStatus(opts: ClassifyOptions = {}): LocalEngineStatus
writeCache(fresh, key);
return fresh;
}