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

ruby-changes:38605

From: usa <ko1@a...>
Date: Sat, 30 May 2015 18:06:21 +0900 (JST)
Subject: [ruby-changes:38605] usa:r50686 (trunk): * lib/tempfile.rb (Remover#call): fixed wrong condition introduced at

usa	2015-05-30 18:05:50 +0900 (Sat, 30 May 2015)

  New Revision: 50686

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

  Log:
    * lib/tempfile.rb (Remover#call): fixed wrong condition introduced at
      r50682.

  Modified files:
    trunk/ChangeLog
    trunk/lib/tempfile.rb
    trunk/test/test_tempfile.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 50685)
+++ ChangeLog	(revision 50686)
@@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Sat May 30 18:05:02 2015  NAKAMURA Usaku  <usa@r...>
+
+	* lib/tempfile.rb (Remover#call): fixed wrong condition.  introduced at
+	  r50682.
+
 Sat May 30 16:12:35 2015  Eric Wong  <e@8...>
 
 	* ext/socket/ancdata.c: use RB_GC_GUARD instead of volatile
Index: lib/tempfile.rb
===================================================================
--- lib/tempfile.rb	(revision 50685)
+++ lib/tempfile.rb	(revision 50686)
@@ -251,7 +251,7 @@ class Tempfile < DelegateClass(File) https://github.com/ruby/ruby/blob/trunk/lib/tempfile.rb#L251
 
       warn "removing #{@tmpfile.path}..." if $DEBUG
 
-      @tmpfile.close if @tmpfile.closed?
+      @tmpfile.close unless @tmpfile.closed?
       begin
         File.unlink(@tmpfile.path)
       rescue Errno::ENOENT
Index: test/test_tempfile.rb
===================================================================
--- test/test_tempfile.rb	(revision 50685)
+++ test/test_tempfile.rb	(revision 50686)
@@ -207,7 +207,7 @@ File.open(path, "w").close https://github.com/ruby/ruby/blob/trunk/test/test_tempfile.rb#L207
     assert_in_out_err('-rtempfile', <<-'EOS') do |(filename), (error)|
 puts Tempfile.new('foo').path
     EOS
-      assert !File.exist?(filename)
+      assert !File.exist?(filename), "tempfile must not be exist after GC."
       assert_nil(error)
     end
   end

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

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