1.0.0 • Published 11 years ago
co-run v1.0.0
co-run
Node core exec() wrapped to return a thunk for co with some stdio options.
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-runLicense
MIT