The way I do this in the project, I am working now.
var exec = require('child_process').exec; function execute(command, callback){ exec(command, function(error, stdout, stderr){ callback(stdout); }); };
Example: fetching a git user
module.exports.getGitUser = function(callback){ execute("git config --global user.name", function(name){ execute("git config --global user.email", function(email){ callback({ name: name.replace("\n", ""), email: email.replace("\n", "") }); }); }); };
Renato Gama Oct 17 '12 at 18:47 2012-10-17 18:47
source share