On Wed, May 07, 2003 at 09:33:50AM +0900, Simon Strandgaard wrote:
> The remaining question: Why does the output differs when
> I run the program several times ???

Because you are killing threads before they have finished doing their useful
work? The threads should exit themselves on seeing an EOF condition on the
read stream, then you can use t.join to wait for them.

But I wonder if you are over-complicating things, if you just want to
capture output into a string. How about:

   mystring = `command 2>&1`

Otherwise, the standard way of doing this is with IO.popen: see
http://ruby-talk.org/68660

See the follow-ups for info on actually redirecting your stdout into a file.

Regards,

Brian.