Comparing version 1.0.8 to 2.0.0
@@ -31,5 +31,14 @@ 'use strict'; | ||
if (command) { | ||
var proc = (0, _crossSpawn.spawn)(command, commandArgs, { stdio: 'inherit', env: env }); | ||
proc.on('exit', process.exit); | ||
return proc; | ||
var _ret = (function () { | ||
var proc = (0, _crossSpawn.spawn)(command, commandArgs, { stdio: 'inherit', env: env }); | ||
process.on('SIGTERM', function () { | ||
return proc.kill('SIGTERM'); | ||
}); | ||
proc.on('exit', process.exit); | ||
return { | ||
v: proc | ||
}; | ||
})(); | ||
if (typeof _ret === 'object') return _ret.v; | ||
} | ||
@@ -36,0 +45,0 @@ } |
{ | ||
"name": "cross-env", | ||
"version": "1.0.8", | ||
"version": "2.0.0", | ||
"description": "Run commands that set environment variables across platforms", | ||
@@ -47,3 +47,2 @@ "main": "src/index.js", | ||
"istanbul": "0.3.21", | ||
"manage-path": "2.0.0", | ||
"mocha": "2.3.3", | ||
@@ -69,2 +68,2 @@ "proxyquire": "1.7.2", | ||
} | ||
} | ||
} |
@@ -8,2 +8,3 @@ # cross-env | ||
[![Code Coverage](https://img.shields.io/codecov/c/github/kentcdodds/cross-env.svg?style=flat-square)](https://codecov.io/github/kentcdodds/cross-env) | ||
[![Dependencies][dependencyci-badge]][dependencyci] | ||
[![Donate][donate-badge]][donate] | ||
@@ -62,1 +63,3 @@ | ||
[donate]: http://kcd.im/donate | ||
[dependencyci-badge]: https://dependencyci.com/github/kentcdodds/cross-env/badge?style=flat-square | ||
[dependencyci]: https://dependencyci.com/github/kentcdodds/cross-env |
@@ -11,2 +11,3 @@ import {spawn} from 'cross-spawn'; | ||
const proc = spawn(command, commandArgs, {stdio: 'inherit', env}); | ||
process.on('SIGTERM', () => proc.kill('SIGTERM')); | ||
proc.on('exit', process.exit); | ||
@@ -13,0 +14,0 @@ return proc; |
@@ -5,3 +5,2 @@ import chai from 'chai'; | ||
import proxyquire from 'proxyquire'; | ||
import getPathVar from 'manage-path/dist/get-path-var'; | ||
import assign from 'lodash.assign'; | ||
@@ -11,3 +10,3 @@ chai.use(sinonChai); | ||
const {expect} = chai; | ||
const spawned = {on: sinon.spy()}; | ||
const spawned = {on: sinon.spy(), kill: sinon.spy()}; | ||
const proxied = { | ||
@@ -70,5 +69,14 @@ 'cross-spawn': { | ||
it(`should propage SIGTERM signal`, () => { | ||
testEnvSetting({ | ||
FOO_ENV: 'foo=bar' | ||
}, 'FOO_ENV="foo=bar"'); | ||
process.emit('SIGTERM'); | ||
expect(spawned.kill).to.have.been.calledWith('SIGTERM'); | ||
}); | ||
function testEnvSetting(expected, ...envSettings) { | ||
const ret = crossEnv([...envSettings, 'echo', 'hello world']); | ||
const env = {[getPathVar()]: process.env[getPathVar()]}; | ||
const env = {}; | ||
env.APPDATA = process.env.APPDATA; | ||
@@ -75,0 +83,0 @@ assign(env, expected); |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
13505
17
160
64
6