https://github.com/raineorshine/spawn-please
Easy and small child_process.spawn
https://github.com/raineorshine/spawn-please
spawn
Last synced: 9 months ago
JSON representation
Easy and small child_process.spawn
- Host: GitHub
- URL: https://github.com/raineorshine/spawn-please
- Owner: raineorshine
- License: isc
- Created: 2015-08-07T14:31:34.000Z (over 10 years ago)
- Default Branch: main
- Last Pushed: 2023-09-17T14:17:30.000Z (over 2 years ago)
- Last Synced: 2025-07-04T16:31:17.407Z (9 months ago)
- Topics: spawn
- Language: JavaScript
- Homepage:
- Size: 204 KB
- Stars: 8
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# spawn-please
[](https://npmjs.org/package/spawn-please)
Easy and small child_process.spawn.
- Promise-based
- Cross-platform
- Pass stdin as an argument
- Rejects on stderr by default, even if exit code is 0
## Install
```sh
$ npm install --save spawn-please
```
## Usage
```typescript
(
command: string,
args?: string[],
options?: Options,
spawnOptions?: any,
): Promise<{
stdout: string
stderr: string
}>
```
```js
import spawn from 'spawn-please'
const { stdout, stderr } = await spawn('printf', ['please?'])
assert.equal(stdout, 'please?')
assert.equal(stderr, '')
```
## Options
- `rejectOnError: boolean` - Throws an error if stderr is non-empty. Default: true.
- `stdin: string` - Send stdin to the spawned child process.
- `stdout: (data: string) => void` - Stream stdout by chunk.
- `stderr: (data: string) => void` - Stream stderr by chunk.
## License
ISC © [Raine Revere](https://github.com/raineorshine)