@easy-install/easy-install
Version:
24 lines (23 loc) • 791 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.run = run;
const path_1 = require("path");
const ei_1 = require("./ei");
const fs_1 = require("fs");
const child_process_1 = require("child_process");
const install_1 = require("./install");
async function run(url, bin, args = process.argv.slice(2), installDir = ei_1.CLI_DIR) {
const binPath = (0, path_1.join)(installDir, (0, ei_1.getBinName)(bin)).replaceAll('\\', '/');
if (!(0, fs_1.existsSync)(binPath)) {
await (0, install_1.install)(url, bin, true, installDir, true);
}
try {
(0, child_process_1.execFileSync)(binPath, args, {
stdio: 'inherit',
cwd: process.cwd(),
});
}
catch (e) {
// FIXME: Ignore js errors
}
}