On Tue, 11 Apr 2006, |MKSM| wrote:

> Hello,
>
> I'm using 'wget' to download a few files and then tar them up. I'm
> using popen to make calls to wget and tar. Problem is that it tries to
> call tar right after the wget call. I need to wait for wget to finish.
> Here is what i've got so far.
>
> categories = [...]
>
> categories.each_with_index { |url,i|
>  IO.popen("wget -r -np -l 0 -w 4 #{url}")

here you have a pipe that's been returned.  wget is writing to it.  you simply
need to read all of wget's output and close the pipe:

   IO.popen("wget -r -np -l 0 -w 4 #{url}"){|pipe| pipe.read}

>  IO.popen("tar -zcf public_html/category_#{i}.tar.gz files")
> }
>
> Thanks in advance.
>
> Ricardo
>
>

-a
-- 
be kind whenever possible... it is always possible.
- h.h. the 14th dali lama