This repository has been archived on 2023-11-14. You can view files and clone it, but cannot push or open issues/pull-requests.
portapy/Download-Latest-Python/node_modules/node-command-line/node-command-line.js

21 lines
535 B
JavaScript
Raw Normal View History

2018-10-30 18:09:58 -04:00
var exec = require('child_process').exec,
Promise = require('bluebird');
var nodeCommandline={
run:executeCommand
};
function executeCommand(command){
return new Promise(function(resolve, reject) {
exec(command, function(error, stdout, stderr) {
if(error) {
console.error(error.message);
return resolve({success: false, error: error.message, stdErr: stderr});
}
console.log(stdout);
return resolve({success: true, message: stdout});
});
});
}
module.exports=nodeCommandline;