From: nobu.nokada@... Date: 2002-09-18T17:46:12+09:00 Subject: Re: Capturing stdout from cmd while letting it print it Hi, At Wed, 18 Sep 2002 16:10:20 +0900, coma_killen@fastmail.fm wrote: > I want to capture the output from a program but still have it print to > STDOUT. > I tried > > r = [] > IO.popen("mycmd") do |pipe| > while (line = pipe.gets) > r << line > STDOUT.puts line > end > end > > but the output will only come after the command has finished running. > This doesn't > work here since the command runs for very long and the user will want > the output. "mycmd" may buffer and not flush the output. How large is the output? Or, it may send output to stderr or console instead of stdout. -- Nobu Nakada