Avoid IOError when returning from Dir.open

Ignore `IOError` if `Dir#close` was done in the block.
This commit is contained in:
dearblue
2023-01-01 17:40:50 +09:00
parent 0c9798373a
commit 72ab1821de
+4 -1
View File
@@ -36,7 +36,10 @@ class Dir
begin
block.call(d)
ensure
d.close
begin
d.close
rescue IOError
end
end
else
self.new(path)