Skip to content

Instantly share code, notes, and snippets.

@albacoretuna
Created September 20, 2016 16:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save albacoretuna/64a3b674a7746759e32135944f2b255b to your computer and use it in GitHub Desktop.
Save albacoretuna/64a3b674a7746759e32135944f2b255b to your computer and use it in GitHub Desktop.
// require an internal utility in node for running commands in command line
var exec = require('child_process').exec;
var child;
// get exec from that utily, give the command you want to run as it's first argument
child = exec('npm install ffi',
function (error, stdout, stderr) {
// these are the result, somehow, it's devided to when there's error, or output etc.
console.log('stdout: ' + stdout);
console.log('stderr: ' + stderr);
if (error !== null) {
console.log('exec error: ' + error);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment