Socket
Socket
Sign inDemoInstall

exec-sh

Package Overview
Dependencies
0
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.3.1 to 0.3.2

3

lib/exec-sh.js
var cp = require('child_process')
var merge = require('merge')

@@ -44,3 +43,3 @@ var defSpawnOptions = { stdio: 'inherit' }

options = options || {}
options = merge(true, defSpawnOptions, options)
options = Object.assign({}, defSpawnOptions, options)
callback = callback || function () {}

@@ -47,0 +46,0 @@ }

{
"name": "exec-sh",
"version": "0.3.1",
"version": "0.3.2",
"description": "Execute shell command forwarding all stdio.",

@@ -27,12 +27,7 @@ "main": "lib/exec-sh.js",

"author": "Aleksandr Tsertkov <tsertkov@gmail.com>",
"license": {
"type": "MIT",
"url": "https://github.com/tsertkov/exec-sh/blob/master/LICENSE"
},
"license": "MIT",
"bugs": {
"url": "https://github.com/tsertkov/exec-sh/issues"
},
"dependencies": {
"merge": "^1.2.0"
},
"dependencies": {},
"devDependencies": {

@@ -42,3 +37,3 @@ "coveralls": "^3.0.1",

"jsdoc": "^3.5.5",
"jshint": "^2.9.5",
"jshint": "^2.9.6",
"mocha": "^5.2.0",

@@ -45,0 +40,0 @@ "sinon": "^6.0.1",

@@ -5,3 +5,2 @@ /* global describe, it, beforeEach, afterEach */

var sinon = require('sinon')
var merge = require('merge')
var cp = require('child_process')

@@ -72,15 +71,37 @@

it('should merge defaults with options', function () {
execSh('command')
var defOptionsClone = merge(true, spawn.getCall(0).args[2])
var options = { key: 'value' }
var expectedOptions = {
key: 'value',
stdio: 'inherit'
}
execSh('command', options)
assert.deepEqual(spawn.getCall(0).args[2], expectedOptions)
})
it('should allow overriding default options', function () {
var options = { foo: 'bar', stdio: null }
var expectedOptions = {
foo: 'bar',
stdio: null
}
execSh('command', options)
assert.deepEqual(spawn.getCall(1).args[2], merge(true, defOptionsClone, options))
assert.deepEqual(spawn.getCall(0).args[2], expectedOptions)
})
// change value of the fist property in default options to null
assert.ok(Object.keys(defOptionsClone).length > 0)
defOptionsClone[Object.keys(defOptionsClone)[0]] = null
execSh('command', defOptionsClone)
assert.deepEqual(spawn.getCall(2).args[2], defOptionsClone)
it('should allow passing nested environment options', function () {
var options = {
env: {
key1: 'value 1',
key2: 'value 2'
}
}
var expectedOptions = {
env: {
key1: 'value 1',
key2: 'value 2'
},
stdio: 'inherit'
}
execSh('command', options)
assert.deepEqual(spawn.getCall(0).args[2], expectedOptions)
})

@@ -87,0 +108,0 @@

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc