From: Eric Hodel Date: 2009-05-20T13:38:53+09:00 Subject: Re: I want to redirect stderr to StringIO. On May 19, 2009, at 21:30, ErMaker wrote: >>> IO.new(2).reopen(StringIO.new) > TypeError: can't convert StringIO into String > from (irb):1:in `reopen' > from (irb):1 >>> IO.new(2).reopen(IO.new(1)) > => # > > StringIO also do as IO, but IO#reopen fails. > > I want to redirect stderr to StringIO, but it doesn't work. Always use reopen as a last resort. http://blog.segment7.net/articles/2006/08/17/stdout-vs-stdout