steadybit
Version:
Command-line interface to interact with the Steadybit API
31 lines • 1.49 kB
JavaScript
;
// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2022 Steadybit GmbH
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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.executeShellCommand = executeShellCommand;
const child_process_1 = require("child_process");
const util_1 = require("util");
const exec = (0, util_1.promisify)(child_process_1.exec);
function executeShellCommand(command_1) {
return __awaiter(this, arguments, void 0, function* (command, { trimOutput = true, cwd, timeout = 60000 } = {}) {
const result = yield exec(command, {
cwd,
timeout,
});
if (trimOutput) {
result.stdout = result.stdout.trim();
result.stderr = result.stderr.trim();
}
return result;
});
}
//# sourceMappingURL=shell.js.map