hi there ...

I want to read from @io while the created thread is
alive. 

t = Thread.fork() {
	@io = IO.popen("wget " + url + " 2>&1")
}

while t.alive?
	i = @io.readline
	if /(.)(\d+)(%]\n)/ =~ i
		@progressbar.setProgress($2.to_i)
	end
end

> ----- Original Message -----
> From: ts <decoux / moulon.inra.fr>
> To: ruby-talk / ruby-lang.org (ruby-talk ML)
> Cc: ruby-talk / ruby-lang.org
> Subject: [ruby-talk:13993] regexp problem ...
> 
> >>>>> "J" == Jens Luedicke <jens / irs-net.com> writes:
> 
> J> io = IO.popen("wget --dot-style=micro " + url)
> 
>  First I need to redirect stderr on stdout, i.e.
> 
>    io = IO.popen("wget --dot-style=micro " + url + " 2>&1")
> 
> J> out = io.readlines
> 
> J> for i in out 
> J> 	print /(.)(\d+)(%]\n)/.match(i)[2], "\n"
> 
>  Best to write it like this
> 
>        if /(.)(\d+)(%]\n)/ =~ i
>           puts $2
>        end
> 
> 
>  If the regexp don't match #match will return nil, and ruby will give an
>  error message (method [] not found for nil)
> 
> 
> Guy Decoux


-- 
with friendly regards....
 	jens luedicke <jens / irs-net.com>
 	http://www.irs-net.com/
 	- C8H10N4O2 -