pull/310/head
Frostebite 2021-12-26 01:48:36 +00:00
parent e57af53dab
commit ca23c2c303
3 changed files with 21 additions and 16 deletions

18
dist/index.js vendored
View File

@ -492,19 +492,21 @@ class RemoteClientSystem {
static Run(command) {
return __awaiter(this, void 0, void 0, function* () {
return yield new Promise((promise) => {
var _a, _b;
let output = '';
const child = child_process_1.exec(command);
(_a = child.stdout) === null || _a === void 0 ? void 0 : _a.on('data', function (data) {
const outputChunk = `${data}`;
const child = child_process_1.exec(command, (error, stdout, stderr) => {
if (error) {
cloud_runner_logger_1.default.logRemoteCli(`[ERROR] ${error.message}`);
throw new Error(error.toString());
}
if (stderr) {
cloud_runner_logger_1.default.logRemoteCli(`[STD-E/DIAG] ${stderr.toString()}`);
}
const outputChunk = `${stdout.toString()}`;
cloud_runner_logger_1.default.logRemoteCli(outputChunk);
output += outputChunk;
});
(_b = child.stderr) === null || _b === void 0 ? void 0 : _b.on('data', function (data) {
cloud_runner_logger_1.default.logRemoteCli(`[STD-ERROR] ${data}`);
});
child.on('close', function (code) {
cloud_runner_logger_1.default.logRemoteCli(`${code} `);
cloud_runner_logger_1.default.logRemoteCli(`${code}`);
promise(output);
});
});

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

@ -5,17 +5,20 @@ export class RemoteClientSystem {
public static async Run(command: string) {
return await new Promise<string>((promise) => {
let output = '';
const child = exec(command);
child.stdout?.on('data', function (data) {
const outputChunk = `${data}`;
const child = exec(command, (error, stdout, stderr) => {
if (error) {
CloudRunnerLogger.logRemoteCli(`[ERROR] ${error.message}`);
throw new Error(error.toString());
}
if (stderr) {
CloudRunnerLogger.logRemoteCli(`[STD-E/DIAG] ${stderr.toString()}`);
}
const outputChunk = `${stdout.toString()}`;
CloudRunnerLogger.logRemoteCli(outputChunk);
output += outputChunk;
});
child.stderr?.on('data', function (data) {
CloudRunnerLogger.logRemoteCli(`[STD-ERROR] ${data}`);
});
child.on('close', function (code) {
CloudRunnerLogger.logRemoteCli(`${code} `);
CloudRunnerLogger.logRemoteCli(`${code}`);
promise(output);
});
});