# simple-subprocess

> Run a subprocess as though you had typed it into the shell.

Latest version **1.0.1** (published 2015-04-04) · ISC license · 0 weekly downloads

## Install

```sh
npm install simple-subprocess
pnpm add simple-subprocess
yarn add simple-subprocess
bun add simple-subprocess
```

## 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 | 1.0.1 |
| Published | 2015-04-04 |
| First published | 2015-04-04 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | http://github.com/davidmason |
| Maintainers | davidmason |

## Links

- npm: https://www.npmjs.com/package/simple-subprocess
- Repository: https://github.com/davidmason/simple-subprocess
- Issues: https://github.com/davidmason/simple-subprocess/issues
- npm.io page: https://npm.io/package/simple-subprocess

## Recent versions

- 1.0.1 (latest) — 2015-04-04
- 1.0.0 — 2015-04-04

## README

# simple-subprocess

Run a subprocess as though you had typed it into the shell.

## Features

 - Runs a command from the current working directory.
 - Pipes all output to standard outputs.
 - Preserves colours in output.
 - Expands wildcards as if the command were run in the shell directly.
 - Works for interactive commands (passes standard input to the subprocess).
 - Returns a [ChildProcess](https://nodejs.org/api/child_process.html) object
   that can have events attached.

Note that the environment for the subprocess may not include things like bash
aliases, so behaviour will differ for aliased commands. If you get different
behaviour, try `type` in your shell to see the real command:

```
[shell]$ type grep
grep is aliased to `grep --color=auto'

```

I can use `grep --color=auto` as my command and get the same behaviour as on
the interactive shell.


## Usage

Run a command, then do something when it exits.

```
var exec = require('simple-subprocess');

console.log('Finding function definitions');

exec('grep --color=auto "function (" **/*.js')
  .on('exit', function (code) {
    console.log('\nFinished search with exit code %s', code);
  });
```

The function returns a ChildProcess, so see
[documentation for ChildProcess](https://nodejs.org/api/child_process.html)
for other events and details.

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