summaryrefslogtreecommitdiff
path: root/lib/tempfile.rb
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-20 15:16:24 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-04-20 15:16:24 +0000
commit65261bda4d964c081fc3a510bfaa094a7647e8bc (patch)
treedda7b6abe5ba42627579ba50b7425c18a010604e /lib/tempfile.rb
parent45e02258c0415e44296c3d3a783238f248d3035e (diff)
* lib/tempfile.rb (Tempfile.create): Close when the block exits.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/tempfile.rb')
-rw-r--r--lib/tempfile.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index fd334c1..971e191 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -370,6 +370,7 @@ def Tempfile.create(basename, *rest)
begin
yield tmpfile
ensure
+ tmpfile.close if !tmpfile.closed?
File.unlink tmpfile
end
else