https://github.com/ragingwind/exec-then
child process execute with promise
https://github.com/ragingwind/exec-then
Last synced: about 1 year ago
JSON representation
child process execute with promise
- Host: GitHub
- URL: https://github.com/ragingwind/exec-then
- Owner: ragingwind
- Created: 2015-02-14T14:16:52.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2015-02-19T03:57:28.000Z (over 11 years ago)
- Last Synced: 2025-04-29T08:01:50.612Z (about 1 year ago)
- Language: JavaScript
- Size: 172 KB
- Stars: 4
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# [![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-url]][daviddm-image]
> Child process execute with promise, deferred
## Install
```sh
$ npm install --save exec-then
```
## Usage
```js
var exec = require('exec-then');
exec('pwd').then(function(res) {
assert(res.stdout.indexOf(path.resolve(__dirname, '../')) !== -1);
}, function(err) {
console.log(err.toString());
assert(false);
});
exec(['ls', '-al'], function(std, deferred) {
if (std.stdout.indexOf('test') === -1) {
return deferred.reject();
}
return true;
}).then(function(res) {
if (res) {
console.log('You have test file');
}
}, function() {
console.log('Where am I?');
});
```
## Options
`exec-node` using same options to [Child Process options](http://goo.gl/axu96) except to options below.
- `verbose`: show stdio/stderr message while child process is running.
## License
MIT © [ragingwind](http://ragingwind.me)
[npm-url]: https://npmjs.org/package/exec-then
[npm-image]: https://badge.fury.io/js/exec-then.svg
[travis-url]: https://travis-ci.org/ragingwind/exec-then
[travis-image]: https://travis-ci.org/ragingwind/exec-then.svg?branch=master
[daviddm-url]: https://david-dm.org/ragingwind/exec-then.svg?theme=shields.io
[daviddm-image]: https://david-dm.org/ragingwind/exec-then