From: Nobuyoshi Nakada Date: 2008-02-07T15:27:20+09:00 Subject: Re: reopen: can't change access mode from "w+" to "w"? Hi, At Wed, 6 Feb 2008 20:58:52 +0900, Sam Ruby wrote in [ruby-core:15378]: > That doesn't work for me. When reopen is passed two parameters, the > first parameter is expected to be a file name. Sorry, it works only in 1.9. > The workaround suggested by Eero Saynatkari does work for me. I've > pasted a diff in terms of the the original test/spec code below my > signature. The only remaining question for me is whether this change in > behavior in Ruby 1.9 is intentional, and that applications need to > conform, or if it is temporary and will soon be corrected. > - out.rewind > - output = out.read > + out.flush > + output = File.open(out.path) {|file| file.read} I think you should close it here instead of flush. It can't open already opened file again on all platforms. -- Nobu Nakada