From: Jens Wille Date: 2008-04-09T06:00:22+09:00 Subject: Re: System commands with streaming output hi alex! i'm sorry, i didn't follow the whole thread, but you probably want to modify your simple example like so: ---- [ foo.rb ] ---- # immediately flush all output to the underlying OS STDOUT.sync = true 10.times do |i| puts i sleep 0.5 end -------------------- ---- [ test.rb ] ---- IO.popen('./foo.rb') { |f| until f.eof? puts f.gets end } --------------------- Alex Wayne [2008-04-08 22:29]: > So it looks the block passed to popen isnt even getting called > until the command that it invokes exits. well, output is buffered first. only when that buffer is filled, your receiving end of the pipe will see it. which, in this case, coincides with the program's exit. if you don't want buffering to happen, you have to set the sync mode to true (see [1]). > Then the variable passed into the block is the entire output of > that command? it just reads the first line from that output, that's what IO#gets does (see [2]). [1] [2] hth jens -- Jens Wille, Dipl.-Bibl. (FH) prometheus - Das verteilte digitale Bildarchiv f端r Forschung & Lehre Kunsthistorisches Institut der Universit辰t zu K旦ln Albertus-Magnus-Platz, D-50923 K旦ln Tel.: +49 (0)221 470-6668, E-Mail: jens.wille@uni-koeln.de http://www.prometheus-bildarchiv.de/