require 'lib/session' puts Session::VERSION lines = [] #STDOUT.sync = true #STDERR.sync = true #Session.use_spawn = true thread = Thread.new { cmd = 'date; sleep 1;' * 3 sh = Session.new :use_spawn=>true sh.execute(cmd) do |o,e| line = o || e lines << [Time.now.to_f, line] puts("\n" + lines.join("\n")) puts '----' STDOUT.flush end }.join