54 lines
2.1 KiB
JavaScript
54 lines
2.1 KiB
JavaScript
"use strict";
|
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
};
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.callFfNative = exports.callFf = void 0;
|
|
const execa_1 = __importDefault(require("execa"));
|
|
const node_child_process_1 = require("node:child_process");
|
|
const path_1 = __importDefault(require("path"));
|
|
const get_executable_path_1 = require("./compositor/get-executable-path");
|
|
const get_explicit_env_1 = require("./compositor/get-explicit-env");
|
|
const make_file_executable_1 = require("./compositor/make-file-executable");
|
|
const truthy_1 = require("./truthy");
|
|
const callFf = ({ args, bin, indent, logLevel, options, binariesDirectory, cancelSignal, }) => {
|
|
const executablePath = (0, get_executable_path_1.getExecutablePath)({
|
|
type: bin,
|
|
indent,
|
|
logLevel,
|
|
binariesDirectory,
|
|
});
|
|
(0, make_file_executable_1.makeFileExecutableIfItIsNot)(executablePath);
|
|
const cwd = path_1.default.dirname(executablePath);
|
|
const task = (0, execa_1.default)(executablePath, args.filter(truthy_1.truthy), {
|
|
cwd,
|
|
env: (0, get_explicit_env_1.getExplicitEnv)(cwd),
|
|
...options,
|
|
});
|
|
cancelSignal === null || cancelSignal === void 0 ? void 0 : cancelSignal(() => {
|
|
task.kill();
|
|
});
|
|
return task;
|
|
};
|
|
exports.callFf = callFf;
|
|
const callFfNative = ({ args, bin, indent, logLevel, options, binariesDirectory, cancelSignal, }) => {
|
|
const executablePath = (0, get_executable_path_1.getExecutablePath)({
|
|
type: bin,
|
|
indent,
|
|
logLevel,
|
|
binariesDirectory,
|
|
});
|
|
(0, make_file_executable_1.makeFileExecutableIfItIsNot)(executablePath);
|
|
const cwd = path_1.default.dirname(executablePath);
|
|
const task = (0, node_child_process_1.spawn)(executablePath, args.filter(truthy_1.truthy), {
|
|
cwd,
|
|
env: (0, get_explicit_env_1.getExplicitEnv)(cwd),
|
|
...options,
|
|
});
|
|
cancelSignal === null || cancelSignal === void 0 ? void 0 : cancelSignal(() => {
|
|
task.kill();
|
|
});
|
|
return task;
|
|
};
|
|
exports.callFfNative = callFfNative;
|