I can run a bash command in node.js like so:
var sys = require(\'sys\')
var exec = require(\'child_process\').exec;
function puts(error, stdout, stderr) { s
From the docs:
If a
callbackfunction is provided, it is called with the arguments(error, stdout, stderr). On success,errorwill benull. On error,errorwill be an instance of Error. Theerror.codeproperty will be the exit code of the child process whileerror.signalwill be set to the signal that terminated the process. Any exit code other than 0 is considered to be an error.
So:
exec('...', function(error, stdout, stderr) {
if (error) {
console.log(error.code);
}
});
Should work.