diff --git a/lib/tasks/cordova.js b/lib/tasks/cordova.js index 72ca12e..8becc3a 100644 --- a/lib/tasks/cordova.js +++ b/lib/tasks/cordova.js @@ -13,6 +13,6 @@ module.exports = function(rawArgs, project) { return function(){ return runCommand(cdvCommand, msg, { cwd: path.join(project.root, 'cordova') - }, { stdout: true })(); + })(); }; }; diff --git a/lib/utils/run-command.js b/lib/utils/run-command.js index d9a77ed..5c4a56e 100644 --- a/lib/utils/run-command.js +++ b/lib/utils/run-command.js @@ -1,9 +1,9 @@ 'use strict'; -var Promise = require('../ext/promise'); -var exec = Promise.denodeify(require('child_process').exec); -var chalk = require('chalk'); -var ui = require('../ui'); +var Promise = require('../ext/promise'); +var exec = require('child_process').exec; +var chalk = require('chalk'); +var ui = require('../ui'); var defaults = require('lodash').defaults; module.exports = function runCommand(command, startedMsg, options) { @@ -17,11 +17,27 @@ module.exports = function runCommand(command, startedMsg, options) { } options = defaults(options, { - maxBuffer: 1000 * 1024 + maxBuffer: 5000 * 1024 }); - return exec(command, options).catch(function(err){ - commandError(command, err); + return new Promise(function(resolve, reject) { + exec(command, options, function(err, stdout, stderr) { + ui.write('\n'); + + if (stdout && stdout.length) { + ui.write(stdout); + } + + if (stderr && stderr.length) { + ui.write(stderr); + } + + if (err) { + return reject(commandError(command, err)); + } + + resolve(stdout); + }); }); }; };