diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-20 00:35:30 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-05-20 00:35:30 +0000 |
commit | c81863c321798391409f8beb2c1660309964efda (patch) | |
tree | 47d5ff9db01a9174199329861b032b8ae19ae90b | |
parent | 91e5ba1cb865a2385d3e1cbfacd824496898e098 (diff) |
* lib/tempfile.rb (Tempfile#unlink): close first for Windows. a
patch from Florian Frank. [ruby-core:23505]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23494 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/tempfile.rb | 5 |
2 files changed, 9 insertions, 1 deletions
@@ -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) |