From: Simon Strandgaard Date: 2004-02-16T20:39:58+09:00 Subject: `close': Bad file descriptor - filename (Errno::EBADF) While upgrading rubicon from 1.6 to 1.8, I bumped into this problem in the builtin/TestIO.rb file. http://rubyforge.org/cgi-bin/viewcvs/cgi/viewcvs.cgi/rubicon/builtin/TestIO.rb?cvsroot=rubytests I have extracted the code which reproduces the problem. Any ideas on how to solve it, would be nice. server> rm testtest server> ruby a.rb a.rb:5:in `close': Bad file descriptor - testtest (Errno::EBADF) from a.rb:5:in `open' from a.rb:5 server> expand -t2 a.rb file = "testtest" File.open(file, "w") do |f| 10.times { |i| f.printf "%02d: This is a line\n", i } end File.open(file, "w") do |f| io = IO.new(f.fileno, "w") io << 1 << "\n" << "dummy" << "\n" << "cat\n" io.close end server> -- Simon Strandgaard