Code coverage report for utils/exec.js

Statements: 30% (3 / 10)      Branches: 0% (0 / 6)      Functions: 0% (0 / 3)      Lines: 30% (3 / 10)      Ignored: none     

All files » utils/ » exec.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 211 1   1                                  
var Promise = require('es6-promise').Promise;
var child_process = require('child_process');
 
module.exports = {
    exec : function execPromise(cmd, args){
        return new Promise(function(resolve, reject){
            child_process.exec(cmd + ' ' + args.join(' '),
                function (error, stdout, stderr) {
                    stdout && console.log(stdout);
                    stderr && console.log(stderr);
                    if (error !== null) {
                        reject( cmd + ' ' + args[0] + ' Error: ' + error);
                    } else {
                        resolve(cmd + ' ' + args[0] + ' Complete');
                    }
                });
        });
    }
};