summaryrefslogtreecommitdiff
path: root/test/lib/minitest
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-29 22:28:47 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-29 22:28:47 +0000
commit83ead3c4a7dc2670bad06745eaccbdd0a9397f46 (patch)
treeec13c5f7f36b09fb6222ae2ecc9e843b3032e2d0 /test/lib/minitest
parentfae18c95be272b2ddb504aa5d26912ccfce84ef6 (diff)
* ext/-test-/dir: Dir#fileno implemented.
* test/lib/minitest/unit.rb (find_fds): Don't return the fd used to scan /proc/$$/fd. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/lib/minitest')
-rw-r--r--test/lib/minitest/unit.rb13
1 files changed, 12 insertions, 1 deletions
diff --git a/test/lib/minitest/unit.rb b/test/lib/minitest/unit.rb
index e880d36..2f31d6d 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