class Redis::Client

def call_loop(command)

def call_loop(command)
  error = nil
  result = without_socket_timeout do
    process([command]) do
      loop do
        reply = read
        if reply.is_a?(CommandError)
          error = reply
          break
        else
          yield reply
        end
      end
    end
  end
  # Raise error when previous block broke out of the loop.
  raise error if error
  # Result is set to the value that the provided block used to break.
  result
end