Skip to content

Commit

Permalink
fix logging of the cordova command output
Browse files Browse the repository at this point in the history
Apparently denodeify doesn't work as expected with exec.
Also bumped up the maxBuffer as I've had some problems with it overflowing in since new iOS8 Xcode
Fixes #95
  • Loading branch information
jakecraige committed Nov 20, 2014
1 parent 43a5785 commit 33e19c0
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/tasks/cordova.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ module.exports = function(rawArgs, project) {
return function(){
return runCommand(cdvCommand, msg, {
cwd: path.join(project.root, 'cordova')
}, { stdout: true })();
})();
};
};
30 changes: 23 additions & 7 deletions lib/utils/run-command.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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);
});
});
};
};
Expand Down

0 comments on commit 33e19c0

Please sign in to comment.