@equinor/fusion-framework-cli
Version:
--- title: Fusion Framework CLI ---
23 lines • 1.35 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { fork } from 'node:child_process';
import { assert } from 'node:console';
export const executeCommand = (program, command,
// TODO map command args
// eslint-disable-next-line @typescript-eslint/no-explicit-any
...options) => __awaiter(void 0, void 0, void 0, function* () {
assert(process.env.CLI_BIN, 'expected bin path in env');
return new Promise((resolve, reject) => {
const job = fork(String(process.env.CLI_BIN), [program, command, ...(options !== null && options !== void 0 ? options : [])], {});
job.addListener('close', resolve);
job.addListener('error', reject);
});
});
//# sourceMappingURL=execute-command.js.map