This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var run_cmd = function(cmd, args) { | |
var promise = require('bluebird'); | |
return new promise(function (resolve, reject) { | |
var spawn = require('child_process').spawn; | |
var child = spawn(cmd, args); | |
var resp = ""; | |
child.stdout.on('data', function (buffer) { resp += buffer.toString() }); | |
//child.stdout.on('end', function(){ resolve(resp); }); | |
child.on('close', function(exitCode){ resolve(resp); }); // < This might be more approperate |