From: Sam Ruby Date: 2008-02-06T03:00:43+09:00 Subject: reopen: can't change access mode from "w+" to "w"? I ran 'rake test' on test/spec [1], using ruby 1.9.0 (2008-02-06 revision 15384) [i686-linux] I get "rake aborted!". After some investigation, I tracked it down to a failure in should-output.rb [2], and reduced the issue to a small test case: === require 'tmpdir' save = STDOUT.dup STDOUT.reopen File.open(File.join(Dir.tmpdir, "should_output_#{$$}"), "w+") puts 'hi' out = STDOUT.dup STDOUT.reopen save out.rewind p out.read === with Ruby 1.8.6, the output is: "hi\n" with Ruby 1.9.0, the output is: reopen.rb:7:in `reopen': /tmp/should_output_8694 can't change access mode from "w+" to "w" (ArgumentError) from reopen.rb:7:in `
' Is this a bug in Ruby 1.9? If not, any suggestions on a workaround for test/spec? - Sam Ruby [1] http://test-spec.rubyforge.org/ [2] http://chneukirchen.org/repos/testspec/lib/test/spec/should-output.rb