summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog4
-rw-r--r--lib/tempfile.rb1
2 files changed, 5 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 95a5a236c9..fd94e6ed10 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Sun Apr 21 00:15:36 2013 Tanaka Akira <akr@fsij.org>
+
+ * lib/tempfile.rb (Tempfile.create): Close when the block exits.
+
Sat Apr 20 23:38:14 2013 Tanaka Akira <akr@fsij.org>
* lib/webrick/httpauth/htpasswd.rb: Use Tempfile.create to avoid
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index fd334c173a..971e1919ea 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