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

ruby-changes:47800

From: nobu <ko1@a...>
Date: Fri, 15 Sep 2017 09:59:42 +0900 (JST)
Subject: [ruby-changes:47800] nobu:r59918 (trunk): rubyspec: jobserver fd may not be available

nobu	2017-09-15 09:59:35 +0900 (Fri, 15 Sep 2017)

  New Revision: 59918

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59918

  Log:
    rubyspec: jobserver fd may not be available
    
    * spec/rubyspec/optional/capi/spec_helper.rb (compile_extension):
      rescue possible EBADF as jobserver fd may not be available.

  Modified files:
    trunk/spec/rubyspec/optional/capi/spec_helper.rb
Index: spec/rubyspec/optional/capi/spec_helper.rb
===================================================================
--- spec/rubyspec/optional/capi/spec_helper.rb	(revision 59917)
+++ spec/rubyspec/optional/capi/spec_helper.rb	(revision 59918)
@@ -57,17 +57,21 @@ def compile_extension(name) https://github.com/ruby/ruby/blob/trunk/spec/rubyspec/optional/capi/spec_helper.rb#L57
 
       make = ENV['MAKE']
       make ||= (RbConfig::CONFIG['host_os'].include?("mswin") ? "nmake" : "make")
-      if File.basename(make, ".*") == "nmake"
+      if File.basename(make, ".*").casecmp?("nmake")
         # suppress logo of nmake.exe to stderr
         ENV["MAKEFLAGS"] = "l#{ENV["MAKEFLAGS"]}"
       end
 
       opts = {}
       if /(?:\A|\s)--jobserver-(?:auth|fds)=(\d+),(\d+)/ =~ ENV["MAKEFLAGS"]
-        r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
-        w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
-        opts[r] = r
-        opts[w] = w
+        begin
+          r = IO.for_fd($1.to_i(10), "rb", autoclose: false)
+          w = IO.for_fd($2.to_i(10), "wb", autoclose: false)
+        rescue Errno::EBADF
+        else
+          opts[r] = r
+          opts[w] = w
+        end
       end
       # Do not capture stderr as we want to show compiler warnings
       output = IO.popen([make, "V=1", "DESTDIR=", opts], &:read)

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

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