Comparing version 0.3.6 to 0.4.0
@@ -1,2 +0,2 @@ | ||
var execSh = require('../') | ||
const execSh = require('../') | ||
@@ -3,0 +3,0 @@ // run interactive bash shell |
@@ -1,4 +0,4 @@ | ||
var cp = require('child_process') | ||
const cp = require('child_process') | ||
var defSpawnOptions = { stdio: 'inherit' } | ||
const defSpawnOptions = { stdio: 'inherit' } | ||
@@ -47,6 +47,6 @@ /** | ||
var child | ||
var stdout = '' | ||
var stderr = '' | ||
var shell = getShell() | ||
let child | ||
let stdout = '' | ||
let stderr = '' | ||
const shell = getShell() | ||
@@ -74,3 +74,3 @@ try { | ||
if (code) { | ||
var e = new Error('Shell command exit with non zero code: ' + code) | ||
const e = new Error('Shell command exit with non zero code: ' + code) | ||
e.code = code | ||
@@ -77,0 +77,0 @@ callback(e, stdout, stderr) |
{ | ||
"name": "exec-sh", | ||
"version": "0.3.6", | ||
"version": "0.4.0", | ||
"description": "Execute shell command forwarding all stdio.", | ||
"main": "lib/exec-sh.js", | ||
"types": "types/index.d.ts", | ||
"scripts": { | ||
"test": "npm run lint && npm run cover-test", | ||
"test": "npm run lint && npm run test-ts && npm run cover-test", | ||
"test-ts": "tsc --noEmit example/example.ts", | ||
"cover-test": "nyc --reporter=lcov --report-dir=artifacts/coverage mocha", | ||
@@ -32,2 +34,3 @@ "lint": "standard --verbose **/*.js", | ||
"devDependencies": { | ||
"@types/node": "^14.14.35", | ||
"coveralls": "^3.1.0", | ||
@@ -39,4 +42,5 @@ "jsdoc": "^3.6.6", | ||
"sinon": "^9.2.4", | ||
"standard": "^16.0.3" | ||
"standard": "^16.0.3", | ||
"typescript": "^4.2.3" | ||
} | ||
} |
@@ -50,6 +50,6 @@ # exec-sh | ||
```javascript | ||
var execSh = require("../"); | ||
const execSh = require("../"); | ||
// run interactive bash shell | ||
execSh("echo lorem && bash", { cwd: "/home" }, function(err){ | ||
execSh("echo lorem && bash", { cwd: "/home" }, (err) => { | ||
if (err) { | ||
@@ -61,4 +61,4 @@ console.log("Exit code: ", err.code); | ||
// collect streams output | ||
var child = execSh(["bash -c id", "echo lorem >&2"], true, | ||
function(err, stdout, stderr){ | ||
const child = execSh(["bash -c id", "echo lorem >&2"], true, | ||
(err, stdout, stderr) => { | ||
console.log("error: ", err); | ||
@@ -74,3 +74,3 @@ console.log("stdout: ", stdout); | ||
```javascript | ||
var execShPromise = require("exec-sh").promise; | ||
const execShPromise = require("exec-sh").promise; | ||
@@ -77,0 +77,0 @@ // run interactive bash shell |
/* global describe, it, beforeEach, afterEach */ | ||
var execSh = require('..') | ||
var assert = require('assert') | ||
var sinon = require('sinon') | ||
var cp = require('child_process') | ||
const execSh = require('..') | ||
const assert = require('assert') | ||
const sinon = require('sinon') | ||
const cp = require('child_process') | ||
@@ -19,3 +19,3 @@ describe('exec-sh', function () { | ||
describe('#execSh() arguments', function () { | ||
var spawn, exitCode, stream | ||
let spawn, exitCode, stream | ||
@@ -71,4 +71,4 @@ stream = { | ||
it('should merge defaults with options', function () { | ||
var options = { key: 'value' } | ||
var expectedOptions = { | ||
const options = { key: 'value' } | ||
const expectedOptions = { | ||
key: 'value', | ||
@@ -82,4 +82,4 @@ stdio: 'inherit' | ||
it('should allow overriding default options', function () { | ||
var options = { foo: 'bar', stdio: null } | ||
var expectedOptions = { | ||
const options = { foo: 'bar', stdio: null } | ||
const expectedOptions = { | ||
foo: 'bar', | ||
@@ -93,3 +93,3 @@ stdio: null | ||
it('should allow passing nested environment options', function () { | ||
var options = { | ||
const options = { | ||
env: { | ||
@@ -100,3 +100,3 @@ key1: 'value 1', | ||
} | ||
var expectedOptions = { | ||
const expectedOptions = { | ||
env: { | ||
@@ -113,3 +113,3 @@ key1: 'value 1', | ||
it("should accept optional 'callback' parameter", function () { | ||
var callback = sinon.spy() | ||
const callback = sinon.spy() | ||
execSh('command', callback) | ||
@@ -121,3 +121,3 @@ execSh('command', { key: 'value' }, callback) | ||
it("should use 'cmd /C' command prefix on windows", function () { | ||
var platform = process.platform | ||
const platform = process.platform | ||
Object.defineProperty(process, 'platform', { value: 'win32' }) | ||
@@ -132,3 +132,3 @@ execSh('command') | ||
it("should use 'sh -c' command prefix on *nix", function () { | ||
var platform = process.platform | ||
const platform = process.platform | ||
process.platform = 'linux' | ||
@@ -135,0 +135,0 @@ execSh('command') |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23908
10
299
9