brew.rb: use HOMEBREW_PATH for external commands.
They shouldn’t need to handle our environment filtering on the PATH as we’re essentially breaking an API for them otherwise.
This commit is contained in:
parent
ce80485aa4
commit
12e0a5ee7d
@ -49,12 +49,16 @@ begin
|
|||||||
end
|
end
|
||||||
|
|
||||||
path = PATH.new(ENV["PATH"])
|
path = PATH.new(ENV["PATH"])
|
||||||
|
homebrew_path = PATH.new(ENV["HOMEBREW_PATH"])
|
||||||
|
|
||||||
# Add contributed commands to PATH before checking.
|
# Add contributed commands to PATH before checking.
|
||||||
path.append(Pathname.glob(Tap::TAP_DIRECTORY/"*/*/cmd"))
|
tap_cmds = Pathname.glob(Tap::TAP_DIRECTORY/"*/*/cmd")
|
||||||
|
path.append(tap_cmds)
|
||||||
|
homebrew_path.append(tap_cmds)
|
||||||
|
|
||||||
# Add SCM wrappers.
|
# Add SCM wrappers.
|
||||||
path.append(HOMEBREW_SHIMS_PATH/"scm")
|
path.append(HOMEBREW_SHIMS_PATH/"scm")
|
||||||
|
homebrew_path.append(HOMEBREW_SHIMS_PATH/"scm")
|
||||||
|
|
||||||
ENV["PATH"] = path
|
ENV["PATH"] = path
|
||||||
|
|
||||||
@ -89,6 +93,9 @@ begin
|
|||||||
system(HOMEBREW_BREW_FILE, "uninstall", "--force", "brew-cask")
|
system(HOMEBREW_BREW_FILE, "uninstall", "--force", "brew-cask")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# External commands expect a normal PATH
|
||||||
|
ENV["PATH"] = homebrew_path unless internal_cmd
|
||||||
|
|
||||||
if internal_cmd
|
if internal_cmd
|
||||||
Homebrew.send cmd.to_s.tr("-", "_").downcase
|
Homebrew.send cmd.to_s.tr("-", "_").downcase
|
||||||
elsif which "brew-#{cmd}"
|
elsif which "brew-#{cmd}"
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user