Skip to content
/ exec-co Public
forked from tj/co-exec

nodejs core exec() function thunk wrapper for "co"

Notifications You must be signed in to change notification settings

Elzair/exec-co

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

nodejs core exec() function thunk wrapper for "co"

Resources

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript 100.0%