mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* lib/csv.rb (CSV.open): Close the opened file when an exception occur.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46224 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
68ac33a511
commit
2ad2007307
3 changed files with 14 additions and 2 deletions
|
|
@ -1,7 +1,12 @@
|
|||
Thu May 29 19:42:49 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* lib/csv.rb (CSV.open): Close the opened file when an exception
|
||||
occur.
|
||||
|
||||
Thu May 29 19:31:10 2014 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* ext/openssl/lib/openssl/ssl.rb (SSLServer#accept): Close a socket
|
||||
if any exception occur.
|
||||
if any exception occur.
|
||||
|
||||
Thu May 29 05:05:29 2014 Eric Wong <e@80x24.org>
|
||||
|
||||
|
|
|
|||
|
|
@ -1260,7 +1260,12 @@ class CSV
|
|||
file_opts = {encoding: Encoding.default_external}.merge(file_opts)
|
||||
retry
|
||||
end
|
||||
csv = new(f, options)
|
||||
begin
|
||||
csv = new(f, options)
|
||||
rescue Exception
|
||||
f.close
|
||||
raise
|
||||
end
|
||||
|
||||
# handle blocks like Ruby's open(), not like the CSV library
|
||||
if block_given?
|
||||
|
|
|
|||
|
|
@ -218,6 +218,8 @@ class TestCSV::Features < TestCSV
|
|||
)
|
||||
end
|
||||
assert_equal("\r\n", zipped.row_sep)
|
||||
ensure
|
||||
zipped.close
|
||||
end if defined?(Zlib::GzipReader)
|
||||
|
||||
def test_gzip_writer_bug_fix
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue