Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hanford/await-exec
Small wrapper around node's child_process exec command, allowing it to easily be used with async/await
https://github.com/hanford/await-exec
async await npm npm-package promise wrapper
Last synced: 12 days ago
JSON representation
Small wrapper around node's child_process exec command, allowing it to easily be used with async/await
- Host: GitHub
- URL: https://github.com/hanford/await-exec
- Owner: hanford
- Created: 2017-12-21T19:33:32.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2022-01-14T17:49:45.000Z (almost 3 years ago)
- Last Synced: 2024-04-13T10:27:43.459Z (9 months ago)
- Topics: async, await, npm, npm-package, promise, wrapper
- Language: JavaScript
- Size: 5.86 KB
- Stars: 28
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# await-exec
Small promise wrapper around node's `child_process#exec` allowing you to use async/await syntax for commands you want to execute.
## Usage
```js
const exec = require('await-exec')async function logger (text) {
await exec(`echo ${text}`)
}for (let k = 0; k < 10; k++) {
logger('worked!')
}
```Optinally you can pass a second `Object` that will get directly passed to cp#exec
## Modern Usage
```
import exec from "await-exec"async function logger (text) {
const { stdout, stderr } = await exec('python --version')
console.log(stdout, stderr)
}
```Questions? Feedback? [Please let me know](https://github.com/hanford/bundle-cop/issues/new)
## License (MIT)
```
WWWWWW||WWWWWW
W W W||W W W
||
( OO )__________
/ | \
/o o| MIT \
\___/||_||__||_|| *
|| || || ||
_||_|| _||_||
(__|__|(__|__|
```
Copyright © 2017-present [Jack Hanford](http://jackhanford.com) [email protected]Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.