# File lib/rubygems/commands/test_command.rb, line 365
  def platform_reader(rake_args)
    # jruby stuffs it under IO, so we'll use that if it's available
    # if we're on 1.9, use open3 regardless of platform.
    # If we're not:
    #   * on windows use win32/open3 from win32-open3 gem
    #   * on unix use open4-vendor

    output, exit_status = *[]

    if IO.respond_to?(:popen4)
      IO.popen4(*rake_args) do |pid, stdin, stdout, stderr|
        output = read_output(stdout, stderr)
      end
      exit_status = $?
    elsif RUBY_VERSION > '1.9'
      require 'open3'
      Open3.popen3(*rake_args) do |stdin, stdout, stderr, thr|
        output = read_output(stdout, stderr)
        exit_status = thr.value
      end
    elsif RUBY_PLATFORM =~ /mingw|mswin/
      begin
        require 'win32/open3'
        Open3.popen3(*rake_args) do |stdin, stdout, stderr|
          output = read_output(stdout, stderr)
        end
        exit_status = $?
      rescue LoadError
        say "1.8/Windows users must install the 'win32-open3' gem to run tests"
        terminate_interaction 1
      end
    else
      require 'open4-vendor'
      exit_status = Open4.popen4(*rake_args) do |pid, stdin, stdout, stderr|
        output = read_output(stdout, stderr)
      end
    end

    return output, exit_status
  end