lib/utils/command.js
function spawnCmd(command, args, options) {
    var d = Promise.defer();
    var child = spawn(command, args, options);

    child.on('error', function(error) {
        return d.reject(error);
    });

    child.stdout.on('data', function (data) {
        d.notify(data);
    });

    child.stderr.on('data', function (data) {
        d.notify(data);
    });

    child.on('close', function(code) {
        if (code === 0) {
            d.resolve();
        } else {
            d.reject(new Error('Error with command "'+command+'"'));
        }
    });

    return d.promise;
}
function spawnCmd(command, args, options) {
    var d = Promise.defer();
    var child = spawn(command, args, options);

    child.on('error', function(error) {
        return d.reject(error);
    });

    child.stdout.on('data', function (data) {
        d.notify(data);
    });

    child.stderr.on('data', function (data) {
        d.notify(data);
    });

    child.on('close', function(code) {
        if (code === 0) {
            d.resolve();
        } else {
            d.reject(new Error('Error with command "'+command+'"'));
        }
    });

    return d.promise;
}
function spawnCmd ( command , args , options ) { var d = Promise . defer ( ) ; var child = spawn ( command , args , options ) ; child . on ( 'error' , function ( error ) { return d . reject ( error ) ; } ) ; child . stdout . on ( 'data' , function ( data ) { d . notify ( data ) ; } ) ; child . stderr . on ( 'data' , function ( data ) { d . notify ( data ) ; } ) ; child . on ( 'close' , function ( code ) { if ( code === 0 ) { d . resolve ( ) ; } else { d . reject ( new Error ( 'Error with command "' + command + '"' ) ) ; } } ) ; return d . promise ; }
Spawn an executable

@param {String} command
@param {Array} args
@param {Object} options
@return {Promise}
Spawn an executable