* Joel VanderWerf <vjoel / PATH.Berkeley.EDU> [2005-02-25 07:19:12 +0900]:

> How could this work if echo is not even a ruby program? Maybe if you run 
> echo with popen, and print the output of that... But if you want it to 
> work with arb. ruby code, this won't help.

It may not be possible. My knowledge of $stdout doesn't run too deep.
So far, I have wrapped the write call, so puts is captured and I 
have reopened stdout to write to a file. So, I figured there should
be a way to capture a system call (since it inherits $stdout from the
current process).

The idea is to do the following:

IO::Tee(file) { 
  # all output is to go to file and screen
  puts "from ruby puts"
  system("echo", "from system")
  exec("echo", "from system")
}

and have the contents of file and the screen be identical.

-- 
Jim Freeze
Code Red. Code Ruby