exec-co

1.3.0 • Public • Published

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

/exec-co/

    Package Sidebar

    Install

    npm i exec-co

    Weekly Downloads

    1

    Version

    1.3.0

    License

    MIT

    Last publish

    Collaborators

    • elzair