aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/tempfile.rb2
-rw-r--r--test/test_tempfile.rb2
3 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 2e3c874aab..1574fd22ea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat May 30 18:05:02 2015 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * lib/tempfile.rb (Remover#call): fixed wrong condition. introduced at
+ r50682.
+
Sat May 30 16:12:35 2015 Eric Wong <e@80x24.org>
* ext/socket/ancdata.c: use RB_GC_GUARD instead of volatile
diff --git a/lib/tempfile.rb b/lib/tempfile.rb
index e2bb9d1f0b..63d4f8c330 100644
--- a/lib/tempfile.rb
+++ b/lib/tempfile.rb
@@ -251,7 +251,7 @@ class Tempfile < DelegateClass(File)
warn "removing #{@tmpfile.path}..." if $DEBUG
- @tmpfile.close if @tmpfile.closed?
+ @tmpfile.close unless @tmpfile.closed?
begin
File.unlink(@tmpfile.path)
rescue Errno::ENOENT
diff --git a/test/test_tempfile.rb b/test/test_tempfile.rb
index 5904050dd7..e9ce45da94 100644
--- a/test/test_tempfile.rb
+++ b/test/test_tempfile.rb
@@ -207,7 +207,7 @@ File.open(path, "w").close
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