Skip to content

Instantly share code, notes, and snippets.

@ggreer
Forked from gjtorikian/ag_spawn.js
Created September 1, 2012 09:28
Show Gist options
  • Save ggreer/3568181 to your computer and use it in GitHub Desktop.
Save ggreer/3568181 to your computer and use it in GitHub Desktop.
Testing Ag via Node script
var spawn = require('child_process').spawn;
var cmd = spawn(
"./ag",
["blah", "."]);
cmd.stdout.setEncoding('utf8');
cmd.stdout.on('data', function (data) {
console.log('stdout: ' + data);
});
cmd.stderr.on('data', function (data) {
console.log('stderr: ' + data);
});
cmd.on('exit', function (code) {
console.log('child process exited with code ' + code);
});
cmd.on('end', function (code) {
console.log('child process exited with code ' + code);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment