Socket
Socket
Sign inDemoInstall

exec-sh

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exec-sh - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

10

package.json
{
"name": "exec-sh",
"version": "0.1.3",
"version": "0.1.4",
"description": "Execute shell command forwarding all stdio.",
"main": "lib/exec-sh.js",
"scripts": {
"test": "mocha --reporter spec && jshint lib/ example/ test/ package.json",
"jsdoc": "jsdoc --private --destination jsdoc lib/"
"test": "npm run cover-test && jshint",
"cover-test": "istanbul cover --dir artifacts/coverage _mocha -- --reporter spec",
"jshint": "jshint lib/ example/ test/",
"jsdoc": "jsdoc --private --destination artifacts/jsdoc lib/"
},

@@ -35,2 +37,4 @@ "repository": {

"devDependencies": {
"coveralls": "^2.11.2",
"istanbul": "^0.3.2",
"jsdoc": "^3.3.0-alpha8",

@@ -37,0 +41,0 @@ "jshint": "^2.5.1",

# exec-sh
Execute shell command forwarding all stdio streams.
[![NPM](https://nodei.co/npm/exec-sh.png)](https://nodei.co/npm/exec-sh/)
[![Build Status](https://travis-ci.org/tsertkov/exec-sh.svg)](https://travis-ci.org/tsertkov/exec-sh)
[![NPM version](https://badge.fury.io/js/exec-sh.png)](http://badge.fury.io/js/exec-sh)
[![David Status](https://david-dm.org/tsertkov/exec-sh.png)](https://david-dm.org/tsertkov/exec-sh)
[![Build Status](https://travis-ci.org/tsertkov/exec-sh.svg?branch=master)](https://travis-ci.org/tsertkov/exec-sh)
[![Coverage Status](https://img.shields.io/coveralls/tsertkov/exec-sh.svg)](https://coveralls.io/r/tsertkov/exec-sh?branch=master)
[![David Status](https://david-dm.org/tsertkov/exec-sh.png)](https://david-dm.org/tsertkov/exec-sh)
---
> Execute shell command forwarding all stdio streams.
## Features
exec-sh is a wrapper for [`child_process.spawn`](http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) with some improvements:
- Cross platform command execution:
- Windows: `cmd /C COMMAND`
- others: `sh -c COMMAND`
- Fowrards all stdio streams to current terminal (by default):
- `execSh("bash")`
- `execsh("echo -n Say: && read i && echo Said:$i")`
- stdout and stderr are passed to callback when available
- `execSh("pwd", console.log)`
## Showcase
```
```javascript
// JavaScript

@@ -22,4 +35,4 @@

```
// Terminal output: interactive bash session
```sh
# Terminal output: interactive bash session

@@ -34,22 +47,5 @@ hello exec-sh

## Features
exec-sh is a wrapper for child_process.spawn with improvements:
- Cross platform command execution:
- Windows: `cmd /C COMMAND`
- others: `sh -c COMMAND`
- Fowrards all stdio streams to current terminal (by default):
- try `execSh("bash")`
- try `execsh("echo -n Say: && read i && echo Said:$i")`
- stdout and stderr are passed to callback when available
- try `execSh("pwd", console.log)`
## Installation
`npm install exec-sh`
## Usage
```
```javascript
var execSh = require("../");

@@ -74,14 +70,34 @@

## Release history
## Public API
- 0.1.0 Initial release
### execSh(command, [options], [callback])
## Testing
Execute shell command forwarding all stdio.
`npm test`
**Parameters:**
- *command* {String | Array} - The command to run, or array of commands
- *[options]* {Object | TRUE} - Options object passed directly to [`child_process.spawn`](http://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options), when `TRUE` then `{ stdio: null }` used
- *[callback]* {Function} - `callback(err, stdout, stderr)`
- *err* {Error | NULL} - Error object. Has `code` property containing last command exit code when available
- *stdout* {String | NULL} - aggregated stdout or `NULL` if not available
- *stderr* {String | NULL} - aggregated stderr or `NULL` if not available
**Return Values:**
Returns [ChildProcess](http://nodejs.org/api/child_process.html#child_process_class_childprocess) object.
## Private API
Complete API Documentation including private and public methods is generated from source code by JSDoc tool and is [available here](https://s3.eu-central-1.amazonaws.com/tsertkov-artifacts/exec-sh/master/jsdoc/index.html).
## Code Coverage
Code coverage report for all files is [available here](https://s3.eu-central-1.amazonaws.com/tsertkov-artifacts/exec-sh/master/coverage/lcov-report/index.html).
## Scripts
- `npm test` - run tests
- `npm run jsdoc` - build jsdoc
## License
The MIT License (MIT)
[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/tsertkov/exec-sh/trend.png)](https://bitdeli.com/free "Bitdeli Badge")
The MIT License (MIT)
/*global describe, it, before, beforeEach, after, afterEach */
var
execSh = require("../"),
execSh = require(".."),
assert = require("assert"),

@@ -5,0 +5,0 @@ sinon = require("sinon"),

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc