Like child_process.exec
but uses a node style callback
var exec = require('exec-callback');
exec('git log', function (err, out) {
// could be a 'git is not installed' error
// could be a CWD is not a git project.
if (err) {
// err.message is either STDERR from process
// or a lower level error
return console.error(err);
}
console.log('out', out)
})
Running child_process.exec
has a strange
(err, stdout, stderr)
interface. This module normalizes it
to be based on (err, value)
. The stderr
has been co-erced
into the err
value.
Most of the time anything written to stderr
is an actual error
and you can bubble them upwards in the simple cases.
This module makes that usage simpler