# smart-spawn

> Spawn an async process and get back stdout, handling errors

Latest version **2.0.1** (published 2016-11-09) · LGPL-3.0+ license · 0 weekly downloads

## Install

```sh
npm install smart-spawn
pnpm add smart-spawn
yarn add smart-spawn
bun add smart-spawn
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.1 |
| Published | 2016-11-09 |
| First published | 2016-10-30 |
| Weekly downloads | 0 |
| License | LGPL-3.0+ |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alex Jordan |
| Maintainers | strugee |
| Keywords | spawn, process |

## Links

- npm: https://www.npmjs.com/package/smart-spawn
- Repository: https://github.com/strugee/node-smart-spawn
- Homepage: https://github.com/strugee/node-smart-spawn#readme
- Issues: https://github.com/strugee/node-smart-spawn/issues
- npm.io page: https://npm.io/package/smart-spawn

## Dependencies (1)

- [concat-stream](https://npm.io/package/concat-stream.md) ^1.5.2

## Recent versions

- 2.0.1 (latest) — 2016-11-09
- 2.0.0 — 2016-11-09
- 1.0.3 — 2016-10-30
- 1.0.2 — 2016-10-30
- 1.0.1 — 2016-10-30
- 1.0.0 — 2016-10-30

## README

# `smart-spawn`

Spawn an async process and get back stdout, handling errors

## Installation

    npm install smart-spawn

## Usage

```js
var smartSpawn = require('smart-spawn');

var process = smartSpawn('ls', ['-l'], process.cwd(), function(err, stdout) {
	if (err) throw err;

	console.log(stdout);
}
```

## Arguments

Arguments are, in order: the name of the process to spawn, arguments passed to the subprocess, the subprocess' working directory, and a callback function.

The callback receives two arguments. The first is an `Error` object which is passed if the process couldn't be spawned or if it exited with a nonzero exit code, otherwise it's `undefined`. The second is the process' stdout upon its completion (regardless of any errors that may have occured).

## Return value

`smart-spawn` will return an instance of [`ChildProcess`][1] representing the spawned subprocess.

## License

LGPL 3.0+

## Author

Alex Jordan <alex@strugee.net>

 [1]: https://nodejs.org/api/child_process.html#child_process_class_childprocess

---
_Source: https://npm.io/package/smart-spawn · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
