I'd like to add that the exit status here is ALWAYS 255, no matter wht
the command is.

db

On Tue, Apr 08, 2003 at 01:56:11AM +0900, Daniel Bretoi wrote:
> Hi,
> 
> For some reason the code I had posted earlier did not always work
> correctly. I've now rearrange the code to work properly as far as
> running, however, now I can't seem to capture the exit status.
> 
> Help?
> 
> def doit(command)
>    logfile = "test"
>    threads = []
>    fh = File.open(logfile,"w")
>    Open3.popen3(command) { |inp,out,err|
> 
>       threads <<  Thread.new(out) { |out|
>          out.each { |line| puts line; fh.print line }
>       }
>       threads <<  Thread.new(err) { |err|
>          err.each { |line| puts line; fh.print line }
>       }
>       threads.each { |t| t.join }
>    }
>    stat = $? >> 8
>    fh.close
>    stat
> end
> 
> 
> -- 
> Apr  7 	IBM announces System/360, 1964
> Apr  7 	Albert Hofmann synthesizes LSD in Switzerland, 1943
> Apr  7 	Alewives run, Cape Cod
> Apr  7*	Omer 10th day

-- 
Apr  7 	IBM announces System/360, 1964
Apr  7 	Albert Hofmann synthesizes LSD in Switzerland, 1943
Apr  7 	Alewives run, Cape Cod
Apr  7*	Omer 10th day