2019-04-19 15:38:03 +09:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2015-04-13 18:16:27 +08:00
|
|
|
old_trap = trap("INT") { exit! 130 }
|
|
|
|
|
|
|
|
require "global"
|
|
|
|
require "debrew"
|
|
|
|
require "fcntl"
|
|
|
|
require "socket"
|
2019-12-28 14:48:34 +05:30
|
|
|
require "cli/parser"
|
|
|
|
|
|
|
|
def postinstall_args
|
|
|
|
Homebrew::CLI::Parser.new do
|
|
|
|
switch :force
|
|
|
|
switch :verbose
|
|
|
|
switch :debug
|
|
|
|
end
|
|
|
|
end
|
2015-04-13 18:16:27 +08:00
|
|
|
|
|
|
|
begin
|
2019-12-28 14:48:34 +05:30
|
|
|
postinstall_args.parse
|
2015-04-13 18:16:27 +08:00
|
|
|
error_pipe = UNIXSocket.open(ENV["HOMEBREW_ERROR_PIPE"], &:recv_io)
|
|
|
|
error_pipe.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
|
|
|
|
|
|
|
|
trap("INT", old_trap)
|
|
|
|
|
2019-12-28 14:48:34 +05:30
|
|
|
formula = Homebrew.args.resolved_formulae.first
|
2020-01-02 13:55:29 +00:00
|
|
|
formula.extend(Debrew::Formula) if Homebrew.args.debug?
|
2016-05-27 01:53:08 -04:00
|
|
|
formula.run_post_install
|
2017-10-07 00:31:28 +02:00
|
|
|
rescue Exception => e # rubocop:disable Lint/RescueException
|
2018-08-17 22:42:37 -04:00
|
|
|
error_pipe.puts e.to_json
|
2015-04-13 18:16:27 +08:00
|
|
|
error_pipe.close
|
|
|
|
exit! 1
|
|
|
|
end
|