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 /lib/tempfile.rb | |
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
Diffstat (limited to 'lib/tempfile.rb')
-rw-r--r-- | lib/tempfile.rb | 5 |
1 files changed, 4 insertions, 1 deletions
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) |