diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/lib/minitest/unit.rb | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/test/lib/minitest/unit.rb b/test/lib/minitest/unit.rb index e880d3654b..2f31d6d2e9 100644 --- a/test/lib/minitest/unit.rb +++ b/test/lib/minitest/unit.rb @@ -2,6 +2,7 @@ require "optparse" require "rbconfig" +require "-test-/dir" ## # Minimal (mostly drop-in) replacement for test-unit. @@ -992,7 +993,17 @@ module MiniTest def find_fds fd_dir = "/proc/#{$$}/fd" if File.directory?(fd_dir) - Dir.entries(fd_dir).grep(/\A\d+\z/).map(&:to_i).sort + fds = Dir.open(fd_dir) {|d| + a = [] + while fn = d.read + a << fn + end + if d.respond_to? :fileno + a -= [d.fileno.to_s] + end + a + } + fds.grep(/\A\d+\z/).map(&:to_i).sort else [] end |