On Wed, 16 Jan 2002 06:31:51 +1100, Eirikur Hallgrimsson wrote:

> def command ( the_command )
>     t = Thread.new do
>         sin, sout, serr =  Open3.popen3( the_command )
>       sout.each_line { |line| puts line }  # prints output to stdout
>       @instanceVar = sout.readlines # get output into array sout.close
>     end # of Thread
> 
> 	print @instanceVar  # instanceVar is unchanged.
> 
>   end # def command

My first guess here is that your "sout.each_line ..." is reading
all the output.  Hence, when you get to the sout.readlines, there
is nothing to read (since each_line has already read it all) and
hence your @instanceVar ends up with an empty string (or nil).

I'd try getting rid of the the each_line code.