formula_info: use RUBY_PATH instead of calling HOMEBREW_BREW_FILE

This ensures correct RUBY_PATH is used when running `brew tests` with
custom `HOMEBREW_RUBY_PATH`

More info: https://github.com/Homebrew/brew/pull/6617#discussion_r336431131
This commit is contained in:
Cheng XU 2019-10-18 22:14:33 +08:00
parent c98b77fd3e
commit 0db4287326
No known key found for this signature in database
GPG Key ID: B19F15830AB4E690

View File

@ -13,7 +13,15 @@ class FormulaInfo
# Looks up formula on disk and reads its info. # Looks up formula on disk and reads its info.
# Returns nil if formula is absent or if there was an error reading it. # Returns nil if formula is absent or if there was an error reading it.
def self.lookup(name) def self.lookup(name)
json = Utils.popen_read(HOMEBREW_BREW_FILE, "info", "--json=v1", name) json = Utils.popen_read(
RUBY_PATH,
"-W0",
"-I", $LOAD_PATH.join(File::PATH_SEPARATOR),
HOMEBREW_LIBRARY_PATH/"brew.rb",
"info",
"--json=v1",
name
)
return unless $CHILD_STATUS.success? return unless $CHILD_STATUS.success?