1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Get rid of LoadError with $DEBUG

This commit is contained in:
Nobuyoshi Nakada 2019-07-17 14:45:33 +09:00
parent af07e07ac9
commit cd372f8db2
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -166,13 +166,14 @@ class Resolv
# Resolv::Hosts is a hostname resolver that uses the system hosts file.
class Hosts
begin
raise LoadError unless /mswin|mingw|cygwin/ =~ RUBY_PLATFORM
require 'win32/resolv'
DefaultFileName = Win32::Resolv.get_hosts_path || IO::NULL
rescue LoadError
DefaultFileName = '/etc/hosts'
if /mswin|mingw|cygwin/ =~ RUBY_PLATFORM and
begin
require 'win32/resolv'
DefaultFileName = Win32::Resolv.get_hosts_path || IO::NULL
rescue LoadError
end
end
DefaultFileName ||= '/etc/hosts'
##
# Creates a new Resolv::Hosts, using +filename+ for its data source.