https://github.com/jamiebuilds/spawndamnit
Take care of your spawn()
https://github.com/jamiebuilds/spawndamnit
async child events node processes promises spawn
Last synced: 11 months ago
JSON representation
Take care of your spawn()
- Host: GitHub
- URL: https://github.com/jamiebuilds/spawndamnit
- Owner: jamiebuilds
- License: mit
- Created: 2018-01-19T02:32:53.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2024-11-18T20:24:09.000Z (over 1 year ago)
- Last Synced: 2025-04-02T08:08:45.132Z (11 months ago)
- Topics: async, child, events, node, processes, promises, spawn
- Language: JavaScript
- Size: 126 KB
- Stars: 82
- Watchers: 2
- Forks: 4
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# spawndamnit
> Take care of your `spawn()`
## Features
- Returns an `await`-able promise
- Collects `stdout` and `stderr` buffers
- Emits events "stdout" and "stderr"
- Automatically kills all spawn processes when parent process dies
## Installation
```sh
yarn add spawndamnit
```
## Usage
**Basic:**
```js
const spawn = require('spawndamnit');
async function main() {
let child = spawn('npm', ['star', 'spawndamnit']);
child.on('stdout', data => console.log(data.toString()));
child.on('stderr', data => console.error(data.toString()));
let { code, stdout, stderr } = await child;
console.log(code === 0 ? 'success' : 'error');
}
```