From: Yusuke Endoh Date: 2010-05-30T21:47:44+09:00 Subject: [ruby-core:30526] [Bug #3119][Open] [Patch] "IOError (closed stream)" error with tempfile unlink then close usage Issue #3119 has been updated by Yusuke Endoh. Status changed from Feedback to Open Assigned to set to Yusuke Endoh Hi, Simon Thank you for your quick response! I understand. diff --git a/lib/tempfile.rb b/lib/tempfile.rb index c45865d..fd42fd6 100755 --- a/lib/tempfile.rb +++ b/lib/tempfile.rb @@ -276,7 +276,11 @@ class Tempfile < DelegateClass(File) STDERR.print "removing ", path, "..." if $DEBUG + begin tmpfile.close if tmpfile + rescue Exception + p $! + end # keep this order for thread safeness if path With this logging patch, your code outpus: $ ./ruby -Ilib -rtempfile -e 't = Tempfile.new("foo"); t.unlink; t.close' # I'll commit your patch soon. Thanks again! -- Yusuke Endoh ---------------------------------------- http://redmine.ruby-lang.org/issues/show/3119 ---------------------------------------- http://redmine.ruby-lang.org