class ParallelTests::Test::Runner

def self.capture_output(out, err, silence)

read output of the process and print it in chunks
def self.capture_output(out, err, silence)
  results = ["", ""]
  loop do
    [[out, $stdout, 0], [err, $stderr, 1]].each do |input, output, index|
      next unless input
      begin
        read = input.readpartial(1000000) # read whatever chunk we can get
        results[index] << read
        output.print read if index == 1 || !silence
      rescue EOFError
        raise if index == 0 # we only care about the end of stdout
      end
    end
  end rescue EOFError
  results
end