[前][次][番号順一覧][スレッド一覧]

ruby-changes:56585

From: Nobuyoshi <ko1@a...>
Date: Wed, 17 Jul 2019 14:53:56 +0900 (JST)
Subject: [ruby-changes:56585] Nobuyoshi Nakada: cd372f8db2 (master): Get rid of LoadError with $DEBUG

https://git.ruby-lang.org/ruby.git/commit/?id=cd372f8db2

From cd372f8db2e050241abf1d7360b7b29ac614ceec Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 17 Jul 2019 14:45:33 +0900
Subject: Get rid of LoadError with $DEBUG


diff --git a/lib/resolv.rb b/lib/resolv.rb
index 099c740..568c879 100644
--- a/lib/resolv.rb
+++ b/lib/resolv.rb
@@ -166,13 +166,14 @@ class Resolv https://github.com/ruby/ruby/blob/trunk/lib/resolv.rb#L166
   # 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.
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]