npm / npme-installer

npm Enterprise installer
https://www.npmjs.com/enterprise
Other
35 stars 21 forks source link

Use -E with sudo to preserve environment #109

Closed nexdrew closed 8 years ago

nexdrew commented 8 years ago

If we use sudo without the -E flag, then environment variables from the interactive shell will not be preserved for the non-interactive shell command, which can subvert things like HTTP_PROXY, inadvertently precluding proxy detection logic in Replicated's install.sh script.

Here's a simple test script, executed in the manner of bin/npmo.js:

# file name: test.sh
echo $MERRY
$ MERRY=christmas sh -c "sudo sh test.sh"

$ MERRY=christmas sh -c "sudo -E sh test.sh"
christmas
bcoe commented 8 years ago

@nexdrew great find, :sheep: -- I've added you as an owner to the npmo repo :+1: