Skip to content

Instantly share code, notes, and snippets.

@dmethvin
Created December 19, 2012 19:46
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 dmethvin/4339862 to your computer and use it in GitHub Desktop.
Save dmethvin/4339862 to your computer and use it in GitHub Desktop.
Test case for node.js exec, particularly for Windows
#!/usr/bin/env node
var child = require("child_process");
child.execFile("git", [ "status" ], function( error, stdout ) {
console.log("==== result from child.execFile() ====");
if ( error ) {
console.error("ERROR: " + error);
}
console.log(stdout);
});
child.exec("git status", function( error, stdout ) {
console.log("==== result from child.exec() ====");
if ( error ) {
console.error("ERROR: " + error);
}
console.log(stdout);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment