From 90b3f9b19a066b14cfa1d67923ca5932db27e414 Mon Sep 17 00:00:00 2001 From: Doug Hazell Date: Fri, 30 Dec 2016 19:46:29 +0000 Subject: [PATCH] fixup --- Library/Homebrew/brew.sh | 19 +++++++++++++++++-- bin/brew | 4 ---- 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh index 92953001d3..14de020659 100644 --- a/Library/Homebrew/brew.sh +++ b/Library/Homebrew/brew.sh @@ -76,7 +76,11 @@ export GEM_OLD_PATH="$GEM_PATH" # Users may have these set, pointing the system Ruby # at non-system gem paths unset GEM_HOME -unset GEM_PATH + +if [[ -z "$HOMEBREW_WHICH_RUBY" ]] +then + unset GEM_PATH +fi # Users may have this set, injecting arbitrary environment changes into # bash processes inside builds @@ -267,6 +271,12 @@ access to all bottles." EOS fi +if [[ -z "$HOMEBREW_ENV_PRUNED" ]] +then + source "$HOMEBREW_LIBRARY/Homebrew/utils/shell_env.sh" + prune-shell-env +fi + # Hide shellcheck complaint: # shellcheck source=/dev/null source "$HOMEBREW_LIBRARY/Homebrew/utils/analytics.sh" @@ -336,7 +346,12 @@ else # shellcheck source=/dev/null source "$HOMEBREW_LIBRARY/Homebrew/utils/ruby.sh" setup-ruby-path - + + if [[ -n "$HOMEBREW_WHICH_RUBY" ]] + then + export HOMEBREW_RUBY_PATH="$(which ruby)" + fi + # Unshift command back into argument list (unless argument list was empty). [[ "$HOMEBREW_ARG_COUNT" -gt 0 ]] && set -- "$HOMEBREW_COMMAND" "$@" { update-preinstall; exec "$HOMEBREW_RUBY_PATH" -W0 "$HOMEBREW_LIBRARY/Homebrew/brew.rb" "$@"; } diff --git a/bin/brew b/bin/brew index 846758c30a..5fe7f892c6 100755 --- a/bin/brew +++ b/bin/brew @@ -113,13 +113,9 @@ export PATH=/usr/bin:/bin:/usr/sbin:/sbin if [[ -n "$HOMEBREW_ENV_FILTERING" ]] then - echo "----- HOMEBREW_ENV_FILTERING set -----" - # Needed TERM to prevent "tput: No value for $TERM and no -T specified" env | grep -E '^(HOMEBREW.*|HOME|PATH|TERM)=.*$' > /tmp/homebrew-env env -i "$HOMEBREW_LIBRARY/Homebrew/utils/shell_env.sh" "$@" else - echo "----- HOMEBREW_ENV_FILTERING NOT set! -----" - source "$HOMEBREW_LIBRARY/Homebrew/brew.sh" fi