homebrew_bootsnap: fail more gracefully.
If `bootsnap` isn't available then print out an error message rather than failing all of Homebrew.
This commit is contained in:
parent
28fb4ff643
commit
cdbc1d43a6
@ -14,17 +14,18 @@ if !ENV["HOMEBREW_NO_BOOTSNAP"] &&
|
|||||||
begin
|
begin
|
||||||
require "bootsnap"
|
require "bootsnap"
|
||||||
rescue LoadError
|
rescue LoadError
|
||||||
raise if ENV["HOMEBREW_BOOTSNAP_RETRY"]
|
unless ENV["HOMEBREW_BOOTSNAP_RETRY"]
|
||||||
|
|
||||||
require "utils/gems"
|
require "utils/gems"
|
||||||
Homebrew.install_bundler_gems!
|
Homebrew.install_bundler_gems!
|
||||||
|
|
||||||
ENV["HOMEBREW_BOOTSNAP_RETRY"] = "1"
|
ENV["HOMEBREW_BOOTSNAP_RETRY"] = "1"
|
||||||
exec ENV["HOMEBREW_BREW_FILE"], *ARGV
|
exec ENV["HOMEBREW_BREW_FILE"], *ARGV
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
ENV.delete("HOMEBREW_BOOTSNAP_RETRY")
|
ENV.delete("HOMEBREW_BOOTSNAP_RETRY")
|
||||||
|
|
||||||
|
if defined?(Bootsnap)
|
||||||
cache = ENV["HOMEBREW_CACHE"] || ENV["HOMEBREW_DEFAULT_CACHE"]
|
cache = ENV["HOMEBREW_CACHE"] || ENV["HOMEBREW_DEFAULT_CACHE"]
|
||||||
# Can't use .blank? here because we haven't required active_support yet.
|
# Can't use .blank? here because we haven't required active_support yet.
|
||||||
raise "Needs HOMEBREW_CACHE or HOMEBREW_DEFAULT_CACHE!" if cache.nil? || cache.empty? # rubocop:disable Rails/Blank
|
raise "Needs HOMEBREW_CACHE or HOMEBREW_DEFAULT_CACHE!" if cache.nil? || cache.empty? # rubocop:disable Rails/Blank
|
||||||
@ -35,4 +36,7 @@ if !ENV["HOMEBREW_NO_BOOTSNAP"] &&
|
|||||||
compile_cache_iseq: true,
|
compile_cache_iseq: true,
|
||||||
compile_cache_yaml: true,
|
compile_cache_yaml: true,
|
||||||
)
|
)
|
||||||
|
else
|
||||||
|
$stderr.puts "Error: HOMEBREW_BOOTSNAP could not `require \"bootsnap\"`!\n\n"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user