diff options
author | Charles Oliver Nutter <[email protected]> | 2024-12-10 15:48:18 -0600 |
---|---|---|
committer | git <[email protected]> | 2025-01-21 08:03:42 +0000 |
commit | b1d5d1666ea6486b3631080d394505451845cfee (patch) | |
tree | e789a0268eca5070fe0a43ea8e37ab2eda0d2747 | |
parent | d3bd8df2b8fac48e7fa614c41519ab9449b55d89 (diff) |
[ruby/resolv] Check for Windows in JRuby-compatible way
https://github.com/ruby/resolv/commit/de95f557b0
-rw-r--r-- | lib/resolv.rb | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/lib/resolv.rb b/lib/resolv.rb index e46b4cef92..2ec1d6c6f9 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -173,11 +173,14 @@ class Resolv 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 @@ -1019,7 +1022,7 @@ class Resolv 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 = {} |