get-shell-vars
Advanced tools
Comparing version 1.1.1 to 1.2.0
@@ -9,22 +9,2 @@ "use strict"; | ||
// Correct order for Login shells is described here: | ||
// http://hayne.net/MacDev/Notes/unixFAQ.html#shellStartup | ||
const profileOrder = [ | ||
".bash_profile", | ||
".bash_login", | ||
".profile", | ||
".bashrc" | ||
]; | ||
const getPathToProfile = (shell) => { | ||
let currentProfileOrder = profileOrder.map(p => p.replace("bash", shell)) // in case the default shell is not bash | ||
.map(p => path.join(process.env.HOME, p)); | ||
for (let profileName of currentProfileOrder) { | ||
if (fs.existsSync(profileName)) { | ||
return profileName; | ||
} | ||
} | ||
}; | ||
const addEtcPathToPath = (environmentVariables) => { | ||
@@ -63,10 +43,4 @@ const pathToEtcPath = "/etc/paths"; | ||
const profileName = getPathToProfile(shell); | ||
if (!profileName) { | ||
return addEtcPathToPath(process.env); | ||
} | ||
try { | ||
const sourcedEnvironmentVars = childProcess.execSync(`${pathToShell} -c "source ${profileName} && env"`); | ||
const sourcedEnvironmentVars = childProcess.execSync(`${pathToShell} -ilc env`); | ||
@@ -73,0 +47,0 @@ if (sourcedEnvironmentVars) { |
@@ -0,0 +0,0 @@ "use strict"; |
{ | ||
"name": "get-shell-vars", | ||
"version": "1.1.1", | ||
"version": "1.2.0", | ||
"description": "Code that sources correct profiles, so that you can use all Environment variables declared in them.", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
@@ -0,0 +0,0 @@ # get-shell-vars |
Sorry, the diff of this file is not supported yet
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
8
15260
66