Comparing version 0.2.5 to 0.2.6
35
index.js
@@ -20,3 +20,3 @@ var child_process = require('child_process'), | ||
function bufferedExec(cmd, args, callback) { | ||
function bufferedExec(cmd, args, env, callback) { | ||
var err = '', | ||
@@ -59,3 +59,3 @@ out = ''; | ||
var child = child_process.spawn(cmd, args, {stdio: [0, 'pipe', 'pipe']}); | ||
var child = child_process.spawn(cmd, args, {env: env, stdio: [0, 'pipe', 'pipe']}); | ||
@@ -71,3 +71,3 @@ child.setMaxListeners(0); | ||
child.on('exit', function(code) { | ||
child.on('close', function(code) { | ||
stdout.destroy(); | ||
@@ -81,4 +81,4 @@ stderr.destroy(); | ||
function interactiveExec(cmd, args, callback) { | ||
var child = child_process.spawn(cmd, args, {stdio: [0, 1, 2]}); | ||
function interactiveExec(cmd, args, env, callback) { | ||
var child = child_process.spawn(cmd, args, {env: env, stdio: [0, 1, 2]}); | ||
@@ -95,4 +95,4 @@ child.setMaxListeners(0); | ||
// Do not echo to stdout/stderr | ||
function quietExec(cmd, args, callback) { | ||
var child = child_process.spawn(cmd, args), | ||
function quietExec(cmd, args, env, callback) { | ||
var child = child_process.spawn(cmd, args, {env: env}), | ||
err = '', | ||
@@ -121,4 +121,7 @@ out = ''; | ||
function exec(args, options, callback) { | ||
var _var, cmd, arg; | ||
var env = {}, e, cmd, arg; | ||
// Copy enviromental variables from process.env. | ||
for (e in process.env) env[e] = process.env[e]; | ||
// Reverse arguments, javascript does not support lookbehind assertions so | ||
@@ -139,8 +142,8 @@ // we'll use a lookahead assertion instead in our regex later. | ||
while ((cmd = args.shift()).indexOf('=') != -1) { | ||
_var = cmd.split('='); | ||
e = cmd.split('='); | ||
if (_var.length != 2) | ||
if (e.length != 2) | ||
throw new Error('Invalid enviromental variable specified.'); | ||
env[_var[0]] = _var[1]; | ||
env[e[0]] = e[1]; | ||
@@ -154,8 +157,8 @@ if (args.length === 0) | ||
if (options.quiet) | ||
return quietExec(cmd, args, callback); | ||
return quietExec(cmd, args, env, callback); | ||
if (options.interactive) | ||
return interactiveExec(cmd, args, callback); | ||
return interactiveExec(cmd, args, env, callback); | ||
return bufferedExec(cmd, args, callback); | ||
return bufferedExec(cmd, args, env, callback); | ||
} | ||
@@ -241,2 +244,6 @@ | ||
wrapper.bufferedExec = bufferedExec | ||
wrapper.quietExec = quietExec | ||
wrapper.interactiveExec = interactiveExec | ||
module.exports = wrapper; |
{ | ||
"name": "executive", | ||
"version": "0.2.5", | ||
"version": "0.2.6", | ||
"description": "exec for the lazy", | ||
@@ -21,5 +21,5 @@ "main": "index.js", | ||
"devDependencies": { | ||
"chai": "~1.3.0", | ||
"mocha": "~1.7.0" | ||
"chai": "~1.6.0", | ||
"mocha": "~1.9.0" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
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 2 instances 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
9681
7
201
2