exec-co
v1.3.0
Published
exec() wrapper for 'co' that returns output and error
Downloads
4
Maintainers
Readme
exec-co
Node core exec()
wrapped to return a thunk for co that returns output and error.
Installation
$ npm install exec-co
Example
Do some stuff with git:
var co = require('co');
var exec = require('exec-co');
co(function *(){
var commit = yield exec('git rev-parse HEAD');
var commits = yield exec('git rev-list master | wc -l');
console.log('the latest commit is %s, with a total of %s', commit.stdout.slice(0, 5), commits.stdout.trim());
var noncmd = yield exec('git nonexistent-cmd');
console.error('Error: %s', noncmd.err.message);
});
License
MIT