diff --git a/src/helpers/llamaCppInstaller.js b/src/helpers/llamaCppInstaller.js index 9789ab887..a573ea22d 100644 --- a/src/helpers/llamaCppInstaller.js +++ b/src/helpers/llamaCppInstaller.js @@ -74,8 +74,7 @@ class LlamaCppInstaller { async getSystemBinaryPath() { return new Promise((resolve) => { - // Cross-platform command resolution - const checkCmd = this.platform === "win32" ? "where" : "which"; + const checkCmd = this.platform === "win32" ? "where.exe" : "which"; const binaryNames = this.platform === "win32" ? ["llama-server.exe"] : ["llama-server"]; let found = false; @@ -83,7 +82,7 @@ class LlamaCppInstaller { for (const name of binaryNames) { const proc = spawn(checkCmd, [name], { - shell: true, + windowsHide: true, stdio: "pipe", }); @@ -95,7 +94,7 @@ class LlamaCppInstaller { proc.on("close", (code) => { if (!found && code === 0 && output) { found = true; - resolve(output.trim().split("\n")[0]); + resolve(output.trim().split(/\r?\n/)[0]); } remaining--; if (remaining === 0 && !found) {