Interactive Processing of print

For example, I have a python program that does

print “hello”
time.sleep(10)
print “world”

and i want to print this on ruby

“hello foo”
(wait 10 seconds)
“world foo”

I tried :

IO.popen(“python example.py”) do |p|
p.each do |line|
puts line + “foo”
end
end

and it does everything except , it waits the 10 seconds before it
begins processing so it is not interactive

i mainly want to process a realtime running application (from any
programming language) that prints many statements which I would like to
intercept and print to the site

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs