I have a small test Ruby program called "count", which counts 1..50.
#!/usr/bin/ruby
#count
for i in 1..50 do
STDOUT.puts i
sleep 1
end
I want to call it from another program, and read the outputted numbers line by line, and output them from the other program, line by line.
However my construction doesn't work:
IO.popen("count","r+") {|f| puts f.readline}
What should I do to make it work? Maybe some modification in the test program "count"?