co-run
v1.0.0
Published
Thunkified shell command runner
Downloads
7
Maintainers
Readme
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-run
License
MIT