Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chris-rock/exec-simple
Run commands in Nodejs. Asynchronously. Get output as you go. Timeout and kill if necessary.
https://github.com/chris-rock/exec-simple
Last synced: about 2 months ago
JSON representation
Run commands in Nodejs. Asynchronously. Get output as you go. Timeout and kill if necessary.
- Host: GitHub
- URL: https://github.com/chris-rock/exec-simple
- Owner: chris-rock
- License: mit
- Created: 2014-05-12T19:43:57.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-27T21:18:24.000Z (over 10 years ago)
- Last Synced: 2024-04-24T02:13:28.916Z (9 months ago)
- Language: JavaScript
- Size: 175 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ExecSimple
[![build status](https://secure.travis-ci.org/chris-rock/exec-simple.png)](http://travis-ci.org/chris-rock/exec-simple)
A simple command runner in nodejs. This is a port of [exec-simple for ruby](https://github.com/arlimus/exec-simple) for nodejs.
## Usage
A simple execution:
var ExecSimple = require('exec-simple');
var es = new ExecSimple('echo test');
es.run().then(function (code) {
console.log('done');
});Handle timeouts:
var es = new ExecSimple('echo "Sleep... wait for it"; sleep 100; echo "DARY"');
es.run().timeout(50).then(function (code) {
console.log('done');
}).catch (function (code) {
console.log('process took too long');
});Recieve `stdout` and `stderr` events
var es = new ExecSimple('echo test');
es.on('control', function (data) {
console.log(data);
});
es.on('stderr', function (data) {
console.log(data);
});
es.on('stdout', function (data) {
console.log(data);
});es.run()
## Installation
npm install exec-simple
## Contributing
1. Fork it ( http://github.com/chris-rock/exec-simple/fork )
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request## Author
- Christoph Hartmann
## License
MIT