build.rb: Use CLI::Parser to parse args

Fixes #7008
This commit is contained in:
Gautham G 2020-02-11 23:47:15 +05:30
parent 708010e6fd
commit 8ce7a55add

View File

@ -13,6 +13,7 @@ require "extend/ENV"
require "debrew" require "debrew"
require "fcntl" require "fcntl"
require "socket" require "socket"
require "cmd/install"
class Build class Build
attr_reader :formula, :deps, :reqs attr_reader :formula, :deps, :reqs
@ -183,13 +184,14 @@ class Build
end end
begin begin
Homebrew.install_args.parse
error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io) error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io)
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC) error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
trap("INT", old_trap) trap("INT", old_trap)
formula = ARGV.formulae.first formula = Homebrew.args.formulae.first
options = Options.create(ARGV.flags_only) options = Options.create(Homebrew.args.flags_only)
build = Build.new(formula, options) build = Build.new(formula, options)
build.install build.install
rescue Exception => e # rubocop:disable Lint/RescueException rescue Exception => e # rubocop:disable Lint/RescueException