Skip to content

Commit

Permalink
fix: sanitize env before spawning npm subprocess
Browse files Browse the repository at this point in the history
  • Loading branch information
nlf committed Sep 1, 2021
1 parent 33d6891 commit d8ac68c
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/install.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,15 @@ const devDeps = [
]

const npm = (root, args) => {
const env = {}
for (const [key, value] of Object.entries(process.env)) {
if (!key.startsWith('npm_')) {
env[key] = value
}
}

return spawn('npm', args, {
env,
cwd: root,
stdioString: true,
})
Expand Down

0 comments on commit d8ac68c

Please # to comment.