Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pawsong/co-run
Thunkified shell command runner
https://github.com/pawsong/co-run
Last synced: about 5 hours ago
JSON representation
Thunkified shell command runner
- Host: GitHub
- URL: https://github.com/pawsong/co-run
- Owner: pawsong
- Created: 2015-05-11T12:19:26.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-05-11T15:49:59.000Z (over 9 years ago)
- Last Synced: 2024-10-16T19:12:21.365Z (about 1 month ago)
- Language: JavaScript
- Size: 156 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# co-run
Node core `exec()` wrapped to return a thunk for [co](https://github.com/visionmedia/co) with some `stdio` options.
[![NPM Version][npm-image]][npm-url]
[![Build Status][travis-image]][travis-url]```js
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](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback).
### [stdout, stderr]
Node core `exec()` [callback](https://nodejs.org/api/child_process.html#child_process_child_process_exec_command_options_callback) return value without error.
## Installation
```
$ npm install co-run
```## License
MIT
[npm-image]: https://img.shields.io/npm/v/co-run.svg
[npm-url]: https://npmjs.org/package/co-run
[travis-image]: https://travis-ci.org/gifff/co-run.svg?branch=master
[travis-url]: https://travis-ci.org/gifff/co-run