First upload version 0.0.1
This commit is contained in:
32
node_modules/node-llama-cpp/dist/bindings/utils/testCmakeBinary.js
generated
vendored
Normal file
32
node_modules/node-llama-cpp/dist/bindings/utils/testCmakeBinary.js
generated
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
import process from "process";
|
||||
import { execFile } from "node:child_process";
|
||||
import path from "path";
|
||||
import { fileURLToPath } from "url";
|
||||
import fs from "fs-extra";
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
export async function testCmakeBinary(cmakeBinaryPath, { cwd = __dirname, env = process.env } = {}) {
|
||||
if (cmakeBinaryPath == null || !(await fs.pathExists(cmakeBinaryPath)))
|
||||
return false;
|
||||
return new Promise((resolve, reject) => {
|
||||
const child = execFile(cmakeBinaryPath, ["--version"], {
|
||||
cwd,
|
||||
env,
|
||||
windowsHide: true
|
||||
});
|
||||
child.on("exit", (code) => {
|
||||
if (code == 0)
|
||||
resolve(true);
|
||||
else
|
||||
reject(false);
|
||||
});
|
||||
child.on("error", reject);
|
||||
child.on("disconnect", () => resolve(false));
|
||||
child.on("close", (code) => {
|
||||
if (code == 0)
|
||||
resolve(true);
|
||||
else
|
||||
resolve(false);
|
||||
});
|
||||
});
|
||||
}
|
||||
//# sourceMappingURL=testCmakeBinary.js.map
|
||||
Reference in New Issue
Block a user