"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.exec = exports.unsafeExec = void 0;
const shelljs_1 = __importDefault(require("shelljs"));
exports.unsafeExec = (command, silent = true) => {
    const result = shelljs_1.default.exec(command, { silent });
    return {
        stdout: result.stdout.trim(),
        stderr: result.stderr.trim(),
        code: result.code,
    };
};
exports.exec = (command, silent = true) => {
    const result = exports.unsafeExec(command, silent);
    if (result.code !== 0) {
        throw new Error(`${command} lead to exit code ${result.code} and ${result.stderr}`);
    }
    return result;
};
//# sourceMappingURL=exec.js.map