Created
November 23, 2015 10:22
-
-
Save pdesterlich/af7ab3dcac02596677fb to your computer and use it in GitHub Desktop.
node run shell command
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
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