# sb-exec

> Process spawning APIs beautified

Latest version **4.0.0** (published 2017-04-14) · MIT license · 0 weekly downloads

## Install

```sh
npm install sb-exec
pnpm add sb-exec
yarn add sb-exec
bun add sb-exec
```

## 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 | 4.0.0 |
| Published | 2017-04-14 |
| First published | 2016-02-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 3 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | steelbrain |
| Maintainers | arcanemagus, steelbrain |
| Keywords | child_process, process, exec |

## Links

- npm: https://www.npmjs.com/package/sb-exec
- Repository: https://github.com/steelbrain/exec
- Homepage: https://github.com/steelbrain/exec#readme
- Issues: https://github.com/steelbrain/exec/issues
- npm.io page: https://npm.io/package/sb-exec

## Dependencies (3)

- [lodash.uniq](https://npm.io/package/lodash.uniq.md) ^4.5.0
- [sb-npm-path](https://npm.io/package/sb-npm-path.md) ^2.0.0
- [consistent-env](https://npm.io/package/consistent-env.md) ^1.2.0

## Recent versions

- 4.0.0 (latest) — 2017-04-14
- 3.1.0 — 2016-09-21
- 3.0.3 — 2016-09-18
- 3.0.2 — 2016-09-05
- 3.0.1 — 2016-08-26
- 3.0.0 — 2016-08-25
- 2.0.5 — 2016-07-11
- 2.0.4 — 2016-06-13
- 2.0.3 — 2016-06-07
- 2.0.2 — 2016-05-08
- 2.0.1 — 2016-05-08
- 2.0.0 — 2016-05-03
- 1.0.5 — 2016-04-20
- 1.0.4 — 2016-04-15
- 1.0.3 — 2016-04-14
- … 3 more at https://npm.io/package/sb-exec/versions

## README

# Exec

[![Greenkeeper badge](https://badges.greenkeeper.io/steelbrain/exec.svg)](https://greenkeeper.io/)

Node's Process spawning APIs beautified

## Installation

```sh
npm install --save sb-exec
```

## API

```js
type $OptionsAccepted = {
  timeout?: number | Infinity, // In milliseconds
  stream?: 'stdout' | 'stderr'  | 'both',
  env: Object,
  stdin?: string | Buffer,
  local?: {
    directory: string,
    prepend?: boolean
  },
  throwOnStderr?: boolean = true,
  allowEmptyStderr?: boolean = false,
  ignoreExitCode?: boolean
} // Also supports all options of child_process::spawn

type PromisedProcess = {
  then(callback: Function): Promise
  catch(callback: Function): Promise
  kill(signal: number)
}

export function exec(filePath: string, parameters: array, options: $OptionsAccepted): PromisedProcess
export function execNode(filePath: string, parameters: array, options: $OptionsAccepted): PromisedProcess
```

## Explanation

### Promise callbacks

* `then` callback is supposed to accept one of these results, depending on `options.stream`:
  * `stdout` and `stderr` will result in a string, representing an stdout or stderr stream, respectively.
  * `both` will result in an object of `{stdout, stderr, exitCode}` representing their respective streams and an exit code of a process.
  * If `options.stream` is not provided it is assumed to be `stdout`, so a promise will result in a string representing an stdout stream.

### `options.local`

`options.local` adds node executables in `node_modules` relative to
`options.local.directory` to `PATH` like in npm scripts.

`options.local.prepend` prioritizes local executables over ones already in `PATH`.

## License

This project is licensed under the terms of MIT License, see the LICENSE file
for more info

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