1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Gracefully handle CSV IO when file descriptor closed.

[Bug #10504][ruby-core:66240]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
hsbt 2017-08-22 06:40:59 +00:00
parent 20aed4495b
commit ede0df3a9b
2 changed files with 9 additions and 1 deletions

View file

@ -1291,7 +1291,7 @@ class CSV
begin
yield csv
ensure
csv.close
csv.closed? || csv.close
end
else
csv

View file

@ -137,6 +137,14 @@ class TestCSV::Interface < TestCSV
end
end
def test_open_handles_prematurely_closed_file_descriptor_gracefully
assert_nothing_raised(Exception) do
CSV.open(@path) do |csv|
csv.close
end
end
end
### Test Write Interface ###
def test_generate