views:

10

answers:

1

I'm firing off cap tasks and other command line scripts from a function but I'm wondering what the best way for me to display real time logs for it.

A: 

I ended up with the solution in this snippet

STDOUT.sync = true
IO.popen(command+" 2>&1") do |pipe|
  pipe.sync = true
  while str = pipe.gets
    puts "-> "+str
  end
end
Randuin