Avoid `IOError` when returning from `Dir.open`
Ignore `IOError` if `Dir#close` was done in the block.
@@ -36,7 +36,10 @@ class Dir
begin
block.call(d)
ensure
+ begin
d.close
+ rescue IOError
+ end
end
else
self.new(path)
