Skip to content

Instantly share code, notes, and snippets.

@pdesterlich
Created November 23, 2015 10:22
Show Gist options
  • Save pdesterlich/af7ab3dcac02596677fb to your computer and use it in GitHub Desktop.
Save pdesterlich/af7ab3dcac02596677fb to your computer and use it in GitHub Desktop.
node run shell command
function run_cmd(cmd, args, callBack ) {
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() { callBack (resp) });
} // ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment