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
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 likeHTTP_PROXY
, inadvertently precluding proxy detection logic in Replicated'sinstall.sh
script.Here's a simple test script, executed in the manner of
bin/npmo.js
: