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

ruby-changes:61020

From: Nobuyoshi <ko1@a...>
Date: Wed, 6 May 2020 10:15:45 +0900 (JST)
Subject: [ruby-changes:61020] 039a8ef786 (master): leakchecker.rb: search /dev/fd too

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

From 039a8ef78673f851e39b43980376c2af40d5cbbc Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Wed, 6 May 2020 10:09:29 +0900
Subject: leakchecker.rb: search /dev/fd too

It is more popular than /proc/self/fd.

diff --git a/tool/lib/leakchecker.rb b/tool/lib/leakchecker.rb
index 03eb539..293ebe6 100644
--- a/tool/lib/leakchecker.rb
+++ b/tool/lib/leakchecker.rb
@@ -35,19 +35,19 @@ class LeakChecker https://github.com/ruby/ruby/blob/trunk/tool/lib/leakchecker.rb#L35
     if IO.respond_to?(:console) and (m = IO.method(:console)).arity.nonzero?
       m[:close]
     end
-    fd_dir = "/proc/self/fd"
-    if File.directory?(fd_dir)
-      fds = Dir.open(fd_dir) {|d|
-        a = d.grep(/\A\d+\z/, &:to_i)
-        if d.respond_to? :fileno
-          a -= [d.fileno]
-        end
-        a
-      }
-      fds.sort
-    else
-      []
+    %w"/proc/self/fd /dev/fd".each do |fd_dir|
+      if File.directory?(fd_dir)
+        fds = Dir.open(fd_dir) {|d|
+          a = d.grep(/\A\d+\z/, &:to_i)
+          if d.respond_to? :fileno
+            a -= [d.fileno]
+          end
+          a
+        }
+        return fds.sort
+      end
     end
+    []
   end
 
   def check_fd_leak(test_name)
-- 
cgit v0.10.2


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

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