diff options
| author | Mike McQuaid | 2017-10-28 19:49:25 +0100 |
|---|---|---|
| committer | Mike McQuaid | 2017-11-03 14:50:17 +0000 |
| commit | 29f81812ccf78c85ddac931dcfea9bfc88af82db (patch) | |
| tree | 35a4ff447a03adb97d38528711fc1c5f98e68bcc /Library | |
| parent | f0b25b5482ba43611c77d94c2326c35f14b6de3d (diff) | |
| download | brew-29f81812ccf78c85ddac931dcfea9bfc88af82db.tar.bz2 | |
brew.rb: cleanup PATH setup.
Avoid adding all the tap commands to the PATH when not necessary.
Diffstat (limited to 'Library')
| -rw-r--r-- | Library/Homebrew/brew.rb | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Library/Homebrew/brew.rb b/Library/Homebrew/brew.rb index 2cc339a83..e21e0bbd4 100644 --- a/Library/Homebrew/brew.rb +++ b/Library/Homebrew/brew.rb @@ -50,11 +50,6 @@ begin path = PATH.new(ENV["PATH"]) homebrew_path = PATH.new(ENV["HOMEBREW_PATH"]) - # Add contributed commands to PATH before checking. - tap_cmds = Pathname.glob(Tap::TAP_DIRECTORY/"*/*/cmd") - path.append(tap_cmds) - homebrew_path.append(tap_cmds) - # Add SCM wrappers. path.append(HOMEBREW_SHIMS_PATH/"scm") homebrew_path.append(HOMEBREW_SHIMS_PATH/"scm") @@ -93,8 +88,14 @@ begin system(HOMEBREW_BREW_FILE, "uninstall", "--force", "brew-cask") end - # External commands expect a normal PATH - ENV["PATH"] = homebrew_path unless internal_cmd + unless internal_cmd + # Add contributed commands to PATH before checking. + tap_cmds = Pathname.glob(Tap::TAP_DIRECTORY/"*/*/cmd") + homebrew_path.append(tap_cmds) + + # External commands expect a normal PATH + ENV["PATH"] = homebrew_path + end if internal_cmd Homebrew.send cmd.to_s.tr("-", "_").downcase |
