exec-sh

NPM

NPM Downloads Build Status Coverage Status David Status

Execute shell command forwarding all stdio streams.

Features

exec-sh is a wrapper for child_process.spawn with some improvements:

Showcase

```javascript // JavaScript

execSh("echo hello exec-sh && bash", { cwd: "/home" }, function(err){ if (err) { console.log("Exit code: ", err.code); } }); ```

```sh

Terminal output: interactive bash session

hello exec-sh bash-3.2$ pwd /home bash-3.2$ exit 99 exit Exit code: 99 ```

Usage

```javascript var execSh = require("../");

// run interactive bash shell execSh("echo lorem && bash", { cwd: "/home" }, function(err){ if (err) { console.log("Exit code: ", err.code); return; }

// collect streams output var child = execSh(["bash -c id", "echo lorem >&2"], true, function(err, stdout, stderr){ console.log("error: ", err); console.log("stdout: ", stdout); console.log("stderr: ", stderr); }); }); ```

Public API

execSh(command, [options], [callback])

Execute shell command forwarding all stdio.

Parameters:

Return Values:

Returns ChildProcess object.

Private API

Complete API Documentation including private and public methods is generated from source code by JSDoc tool and is available here.

Code Coverage

Code coverage report for all files is available here.

Scripts

License

The MIT License (MIT)