зеркало из https://github.com/github/ruby.git
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:
Родитель
20aed4495b
Коммит
ede0df3a9b
|
@ -1291,7 +1291,7 @@ class CSV
|
|||
begin
|
||||
yield csv
|
||||
ensure
|
||||
csv.close
|
||||
csv.closed? || csv.close
|
||||
end
|
||||
else
|
||||
csv
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче