[前][次][番号順一覧][スレッド一覧]

ruby-changes:11839

From: matz <ko1@a...>
Date: Wed, 20 May 2009 09:35:47 +0900 (JST)
Subject: [ruby-changes:11839] Ruby:r23494 (trunk): * lib/tempfile.rb (Tempfile#unlink): close first for Windows. a

matz	2009-05-20 09:35:30 +0900 (Wed, 20 May 2009)

  New Revision: 23494

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=23494

  Log:
    * lib/tempfile.rb (Tempfile#unlink): close first for Windows.  a
      patch from Florian Frank.  [ruby-core:23505]

  Modified files:
    trunk/ChangeLog
    trunk/lib/tempfile.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 23493)
+++ ChangeLog	(revision 23494)
@@ -1,3 +1,8 @@
+Wed May 20 06:20:05 2009  Yukihiro Matsumoto  <matz@r...>
+
+	* 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@r...>
 
 	* encoding.c (rb_enc_codepoint_len): combine rb_enc_codepoint()
Index: lib/tempfile.rb
===================================================================
--- lib/tempfile.rb	(revision 23493)
+++ lib/tempfile.rb	(revision 23494)
@@ -136,7 +136,10 @@
   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)

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]