summaryrefslogtreecommitdiffstats
path: root/lib/tempfile.rb
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-22 09:49:44 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-22 09:49:44 +0000
commiteb8467b99457445df16fd716030818d2d3dff5f3 (patch)
treeb2c5fbba5923498965105a3bfb70c733473c00d0 /lib/tempfile.rb
parent156e374f959d7ac9269623fcba9871341d0e7f2c (diff)
merges r23494 from trunk into ruby_1_9_1.
-- * 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/branches/ruby_1_9_1@23537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/tempfile.rb')
-rw-r--r--lib/tempfile.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index 601bb8d2f..3319d4f88 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)