Improve rescue nesting.
This commit is contained in:
parent
69e4ad9809
commit
1bdbb0f462
@ -516,10 +516,10 @@ module Homebrew
|
||||
|
||||
# Our gettext formula will be caught by check_linked_keg_only_brews
|
||||
gettext = begin
|
||||
Formulary.factory("gettext")
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
Formulary.factory("gettext")
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
homebrew_owned = @found.all? do |path|
|
||||
Pathname.new(path).realpath.to_s.start_with? "#{HOMEBREW_CELLAR}/gettext"
|
||||
end
|
||||
@ -537,10 +537,10 @@ module Homebrew
|
||||
return if @found.empty?
|
||||
|
||||
libiconv = begin
|
||||
Formulary.factory("libiconv")
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
Formulary.factory("libiconv")
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
if libiconv && libiconv.linked_keg.directory?
|
||||
unless libiconv.keg_only?
|
||||
<<-EOS.undent
|
||||
|
||||
@ -269,10 +269,10 @@ class AbstractFileDownloadStrategy < AbstractDownloadStrategy
|
||||
case entries.length
|
||||
when 0 then raise "Empty archive"
|
||||
when 1 then begin
|
||||
Dir.chdir entries.first
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
Dir.chdir entries.first
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -56,10 +56,10 @@ require "compat" unless ARGV.include?("--no-compat") || ENV["HOMEBREW_NO_COMPAT"
|
||||
|
||||
ORIGINAL_PATHS = ENV["PATH"].split(File::PATH_SEPARATOR).map do |p|
|
||||
begin
|
||||
Pathname.new(p).expand_path
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
Pathname.new(p).expand_path
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
end.compact.freeze
|
||||
|
||||
# TODO: remove this as soon as it's removed from commands.rb.
|
||||
|
||||
@ -339,10 +339,10 @@ class BottleSpecification
|
||||
os_versions = collector.keys
|
||||
os_versions.map! do |osx|
|
||||
begin
|
||||
MacOS::Version.from_symbol osx
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
MacOS::Version.from_symbol osx
|
||||
rescue
|
||||
nil
|
||||
end
|
||||
end.compact!
|
||||
os_versions.sort.reverse_each do |os_version|
|
||||
osx = os_version.to_sym
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user