co-run

1.0.0 • Public • Published

co-run

Node core exec() wrapped to return a thunk for co with some stdio options.

NPM Version Build Status

var co = require('co'),
    run = require('co-run');
 
co(function* () {
  yield run('echo "Hello World!"', {
    stdout: function (data) {
      console.log('stdout:', data);
    }
  });
});

API

[stdout, stderr] = yield run(cmd, options, execOptions)

cmd

Type: String

Shell command to execute.

options.stdout

Type: Writable Stream or Function
Default: null

child process's stdout handler.

If Writable Stream is given, it is piped to child process's stdout.
If Function is given, it used as data event handler.

options.stderr

Type: Writable Stream or Function
Default: null

child process's stderr handler.

If Writable Stream is given, it is piped to child process's stderr.
If Function is given, it used as data event handler.

options.stdin

Type: Readable Stream
Default: null

Stream that is used as child process's stdin.

execOptions

Type: Object

Node core exec() options.

[stdout, stderr]

Node core exec() callback return value without error.

Installation

$ npm install co-run

License

MIT

Package Sidebar

Install

npm i co-run

Weekly Downloads

2

Version

1.0.0

License

MIT

Last publish

Collaborators

  • giff