diff --git a/Library/Homebrew/build.rb b/Library/Homebrew/build.rb index 2313210c8a..d0ec6dacf7 100644 --- a/Library/Homebrew/build.rb +++ b/Library/Homebrew/build.rb @@ -135,7 +135,7 @@ class Build } with_env(new_env) do - formula.extend(Debrew::Formula) if Homebrew.args.debug? + formula.extend(Debrew::Formula) if args.debug? formula.update_head_version @@ -208,7 +208,10 @@ class Build end begin + Homebrew.args = Homebrew::CLI::Parser.new.parse(ARGV.dup.freeze, ignore_invalid_options: true) + args = Homebrew.install_args.parse + error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io) error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) diff --git a/Library/Homebrew/cli/parser.rb b/Library/Homebrew/cli/parser.rb index ba73c7449a..7d414e07d0 100644 --- a/Library/Homebrew/cli/parser.rb +++ b/Library/Homebrew/cli/parser.rb @@ -49,7 +49,7 @@ module Homebrew @formula_options = false self.class.global_options.each do |short, long, desc| - switch short, long, description: desc + switch short, long, description: desc, env: option_to_name(long) end instance_eval(&block) if block_given? diff --git a/Library/Homebrew/test.rb b/Library/Homebrew/test.rb index 233c323383..2936c20715 100644 --- a/Library/Homebrew/test.rb +++ b/Library/Homebrew/test.rb @@ -16,6 +16,8 @@ require "dev-cmd/test" TEST_TIMEOUT_SECONDS = 5 * 60 begin + Homebrew.args = Homebrew::CLI::Parser.new.parse(ARGV.dup.freeze, ignore_invalid_options: true) + args = Homebrew.test_args.parse error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io) error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) @@ -25,7 +27,7 @@ begin formula = args.resolved_formulae.first formula.extend(Homebrew::Assertions) formula.extend(Homebrew::FreePort) - formula.extend(Debrew::Formula) if Homebrew.args.debug? + formula.extend(Debrew::Formula) if args.debug? ENV.extend(Stdenv) ENV.setup_build_environment(formula: formula)