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 | 48c7d979b908fd41c54c77ca5094d5dcd0a6f7d9 (patch) | |
tree | 47d5ff9db01a9174199329861b032b8ae19ae90b | |
parent | da4d53795fe404e58a706c387c01b7c5b2bafc2a (diff) | |
download | ruby-48c7d979b908fd41c54c77ca5094d5dcd0a6f7d9.tar.gz ruby-48c7d979b908fd41c54c77ca5094d5dcd0a6f7d9.tar.xz ruby-48c7d979b908fd41c54c77ca5094d5dcd0a6f7d9.zip |
* lib/tempfile.rb (Tempfile#unlink): close first for Windows. a
patch from Florian Frank. [ruby-core:23505]
git-svn-id: http://svn.ruby-lang.org/repos/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 e3934b5d0..46803b20f 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) |