From: Pito Salas Date: 2009-08-25T05:54:08+09:00 Subject: Re: Asynchronous process to process pipe IO Robert Klemme wrote: > On 24.08.2009 22:16, Joel VanderWerf wrote: >>> i = 0 >>> >>> >> i = i+1 >> end >> else >> exec("ruby -e '3.times {|i| p i; sleep 1}'") >> end >> end >> >> Does it work that way for you? > > Why are you guys using such a complex construction? If you just want to > see the output when it comes why not just: > > system "./iacommand.rb" > > Or maybe this, if you need to process the output: > > IO.popen "./iacommand.rb" do |io| > io.each_line do |line| > puts line > end > end > > Note, you may have to do $stdout.sync = true in "iacommand.rb". > > Kind regards > > robert Robert, Thanks, the $stdout.sync = true was the magic bullet. Now, I am not exactly clear (reading the doc) about the difference between exec and system... I do need to be able to send command line arguments to iacommand.rb and I do indeed need to process the output 'as it appears.' Thanks!! Pito -- Posted via http://www.ruby-forum.com/.