pull/310/head
Frostebite 2021-12-26 01:33:03 +00:00
parent 43476cbf0c
commit e57af53dab
3 changed files with 16 additions and 23 deletions

19
dist/index.js vendored
View File

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

2
dist/index.js.map vendored

File diff suppressed because one or more lines are too long

View File

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