Skip to content

Commit

Permalink
Merge pull request #75 from headius/jruby_support
Browse files Browse the repository at this point in the history
Integrate JRuby changes
  • Loading branch information
nobu authored Jan 21, 2025
2 parents c4bfa07 + de95f55 commit a70341b
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/resolv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -173,11 +173,14 @@ class ResolvError < StandardError; end

class ResolvTimeout < Timeout::Error; end

WINDOWS = /mswin|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM || ::RbConfig::CONFIG['host_os'] =~ /mswin/
private_constant :WINDOWS

##
# Resolv::Hosts is a hostname resolver that uses the system hosts file.

class Hosts
if /mswin|mingw|cygwin/ =~ RUBY_PLATFORM and
if WINDOWS
begin
require 'win32/resolv'
DefaultFileName = Win32::Resolv.get_hosts_path || IO::NULL
Expand Down Expand Up @@ -1019,7 +1022,7 @@ def Config.default_config_hash(filename="/etc/resolv.conf")
if File.exist? filename
config_hash = Config.parse_resolv_conf(filename)
else
if /mswin|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM
if WINDOWS
require 'win32/resolv'
search, nameserver = Win32::Resolv.get_resolv_info
config_hash = {}
Expand Down

0 comments on commit a70341b

Please sign in to comment.