Hi,

At Thu, 11 Jul 2002 02:18:56 +0900,
Massimiliano Mirra wrote:
> The following does work for stdout *only*.  It does not work for
> stderr.  redir is as above.
> 
> 
> class TempIO
> 	def initialize
> 		@buffer = ''
> 	end
> 	
> 	def write(str)
> 		@buffer << str
> 		str.length
> 	end
> 
> 	def close 
> 	end
> end

Redirection works for IO descriptors.  This TempIO has meaning
only in the process, but nothing for child processes.

> out, err = TempIO.new, TempIO.new
> 
> redir(out, err) do
>   puts "hello, world!"
>   `ls notexist`
> end

Therefore, none of stdout and stderr was redirected here, but
backticks just worked.

-- 
Nobu Nakada