Skip to content

Instantly share code, notes, and snippets.

@lijie2000
Forked from s4y/gist:1215700
Last active August 29, 2015 14:13
Show Gist options
  • Save lijie2000/d8570d9cce3a5eaf66f1 to your computer and use it in GitHub Desktop.
Save lijie2000/d8570d9cce3a5eaf66f1 to your computer and use it in GitHub Desktop.
var child_process = require('child_process');
// exec: spawns a shell.
child_process.exec('ls -lah /tmp', function(error, stdout, stderr){
console.log(stdout);
});
// execFile: executes a file with the specified arguments
child_process.execFile('ls', ['-lah', '/tmp'], function(error, stdout, stderr){
console.log(stdout);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment