Skip to content

Instantly share code, notes, and snippets.

View servel333's full-sized avatar

Nathaniel Perry servel333

View GitHub Profile
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