From: Simon Nicholls Date: 2010-05-30T18:55:58+09:00 Subject: [ruby-core:30515] [Bug #3119] [Patch] "IOError (closed stream)" error with tempfile unlink then close usage Issue #3119 has been updated by Simon Nicholls. That's OK, I can add some output to make it simpler. After all, there is not always a hard error when closing a previously closed file. With the following debug output in the Remover call method (Remover#call:277): STDERR.print "path=>#{path}, tmpfile=>#{tmpfile}\n" Running the following code (you need to close the file in order to execute _close): ruby -rtempfile -e 't = Tempfile.new("foo"); t.unlink; t.close' With the patch included here, the output is: path=>, tmpfile=> But without the patch, the output is: path=>, tmpfile=># This is because _close is unable to clear out the reference to the tmpfile, as mentioned previously. When the Remover sees the tmpfile, it will re-close the file in error. ---------------------------------------- http://redmine.ruby-lang.org/issues/show/3119 ---------------------------------------- http://redmine.ruby-lang.org