# File lib/rhc/ssh_helpers.rb, line 37
    def ssh_ruby(host, username, command)
      debug "Opening Net::SSH connection to #{host}, #{username}, #{command}"
      Net::SSH.start(host, username) do |session|
        #:nocov:
        session.open_channel do |channel|
          channel.request_pty do |ch, success|
            say "pty could not be obtained" unless success
          end

          channel.on_data do |ch, data|
            puts data
          end
          channel.exec command
        end
        session.loop
        #:nocov:
      end
    rescue Errno::ECONNREFUSED => e
      raise RHC::SSHConnectionRefused.new(host, username)
    rescue SocketError => e
      raise RHC::ConnectionFailed, "The connection to #{host} failed: #{e.message}"
    end