From: Dan Zwell Date: 2007-07-22T18:30:23+09:00 Subject: Re: IO.popen - continuous output Sebastian Hungerecker wrote: > Dan Zwell wrote: > >> file1: >> #!/usr/bin/env ruby >> 5.times {puts "hi"; sleep 0.5} >> >> file2: >> #!/usr/bin/env ruby >> IO.popen("./file1").each_line { |line| puts line } >> >> When running file2 (which should stream the output from file1), the >> output is not streamed, but instead saved up until "file1" finishes >> running and then dumped. > > That seems to be a buffering issue. If you set STDOUT.sync to true in file1, > it will work as expected. > > Thanks, that's good to know. Having this behavior unexplained made me a bit nervous about using IO.popen.