summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/tempfile.rb5
2 files changed, 9 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 8c767b01cd..f6dde0ce69 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed May 20 06:20:05 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * lib/tempfile.rb (Tempfile#unlink): close first for Windows. a
+ patch from Florian Frank. [ruby-core:23505]
+
Wed May 20 00:13:38 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
* encoding.c (rb_enc_codepoint_len): combine rb_enc_codepoint()
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index e3934b5d08..46803b20f2 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -136,7 +136,10 @@ class Tempfile < DelegateClass(File)
def unlink
# keep this order for thread safeness
begin
- File.unlink(@tmpname) if File.exist?(@tmpname)
+ if File.exist?(@tmpname)
+ closed? or close
+ File.unlink(@tmpname)
+ end
@@cleanlist.delete(@tmpname)
@data = @tmpname = nil
ObjectSpace.undefine_finalizer(self)