aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/brew15
1 files changed, 14 insertions, 1 deletions
diff --git a/bin/brew b/bin/brew
index 593043f9f..43a807c7b 100755
--- a/bin/brew
+++ b/bin/brew
@@ -44,4 +44,17 @@ fi
HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library"
-source "$HOMEBREW_LIBRARY/Homebrew/brew.sh"
+if [[ -n "$HOMEBREW_ENV_FILTERING" ]]
+then
+ PATH="/usr/bin:/bin:/usr/sbin:/sbin"
+
+ FILTERED_ENV=()
+ for VAR in HOME SHELL PATH TERM LOGNAME USER "${!HOMEBREW_@}"
+ do
+ FILTERED_ENV+=( "${VAR}=${!VAR}" )
+ done
+
+ /usr/bin/env -i "${FILTERED_ENV[@]}" /bin/bash "$HOMEBREW_LIBRARY/Homebrew/brew.sh" "$@"
+else
+ source "$HOMEBREW_LIBRARY/Homebrew/brew.sh"
+fi