summaryrefslogtreecommitdiff
path: root/lib/resolv.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-28 14:11:35 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-03-28 14:11:35 +0000
commit80466df690e1fc952d661686baaa6f3b245d42a0 (patch)
tree3a3c4ed79fe606556dd15585ff6bcce8a85942c4 /lib/resolv.rb
parent05f5cbeb7588fca122e92d9e9fe8a9d1e07e3abc (diff)
* lib/resolv.rb: Test Windows platform by detecting LoadError when
require 'win32/resolv' suggested by Nobuyoshi Nakada [ruby-core:53389]. [ruby-core:53388] [Feature #8090] Reported by Charles Nutter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39988 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/resolv.rb')
-rw-r--r--lib/resolv.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb
index b38c42ab3f..e52649d32c 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -165,10 +165,10 @@ class Resolv
# Resolv::Hosts is a hostname resolver that uses the system hosts file.
class Hosts
- if /mswin|mingw|bccwin/ =~ RUBY_PLATFORM
+ begin
require 'win32/resolv'
DefaultFileName = Win32::Resolv.get_hosts_path
- else
+ rescue LoadError
DefaultFileName = '/etc/hosts'
end