diff --git a/build/execute.js b/build/execute.js index 8cc546a..bde4a05 100644 --- a/build/execute.js +++ b/build/execute.js @@ -2,28 +2,10 @@ import {spawn} from 'child_process'; export function execute(cmd, args, options) { return new Promise((resolve, reject) => { - const proc = spawn(cmd, args, {...options || {}, shell: true}); - let stdout = []; - let stderr = []; - - proc.stdout.setEncoding('utf8'); - proc.stdout.on('data', function(data) { - const str = data.toString(); - const lines = str.split(/(\r?\n)/g); - stdout = stdout.concat(lines); - }); - - proc.stderr.setEncoding('utf8'); - proc.stderr.on('data', function(data) { - const str = data.toString(); - const lines = str.split(/(\r?\n)/g); - stderr = stderr.concat(lines); - }); - + const proc = spawn(cmd, args, {...options || {}, shell: true, stdio: 'inherit'}); proc.on('close', function(code) { - const result = {exitCode: code, stdout: stdout.join('\n'), stderr: stderr.join('\n')}; + const result = {exitCode: code}; if (parseInt(code) !== 0) { - console.error(result.stderr.replaceAll(/\n\n+/g, '\n')); reject(result); } else { resolve(null, result);