From 0db4287326d088a8dabc655bbf4adf6d2e13a204 Mon Sep 17 00:00:00 2001 From: Cheng XU Date: Fri, 18 Oct 2019 22:14:33 +0800 Subject: [PATCH] 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 --- Library/Homebrew/formula_info.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Library/Homebrew/formula_info.rb b/Library/Homebrew/formula_info.rb index 42a81bf8a5..75013a40c1 100644 --- a/Library/Homebrew/formula_info.rb +++ b/Library/Homebrew/formula_info.rb @@ -13,7 +13,15 @@ class FormulaInfo # Looks up formula on disk and reads its info. # Returns nil if formula is absent or if there was an error reading it. 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?