<commit_before>require 'socket'
require 'rrails'
module RemoteRails
  class Client
    def self.new_with_options(argv)
      self.new({ :cmd => argv })
    end

    def initialize(options={})
      @cmd = options[:cmd] || "rails"
      @rails_env = options[:rails_env] || 'development'
      @host = options[:host] || 'localhost'
      @port = options[:port] || DEFAULT_PORT[@rails_env]
    end

    def run
      sock = TCPSocket.open(@host, @port)
      sock.puts(@cmd)
      while line = sock.gets
        puts line
        if line =~ /^finished\t/
          return
        end
      end
    end
  end
end<commit_msg>output out to stdout, error to stderr.<commit_after>require 'socket'
require 'rrails'
module RemoteRails
  class Client
    def self.new_with_options(argv)
      self.new({ :cmd => argv })
    end

    def initialize(options={})
      @cmd = options[:cmd] || "rails"
      @rails_env = options[:rails_env] || 'development'
      @host = options[:host] || 'localhost'
      @port = options[:port] || DEFAULT_PORT[@rails_env]
    end

    def run
      sock = TCPSocket.open(@host, @port)
      sock.puts(@cmd)
      while line = sock.gets
        if line =~ /^finished\t/
          return
        elsif line =~ /^OUT\t(.+)$/
          $stdout.puts($1)
        elsif line =~ /^ERROR\t(.+)$/
          $stderr.puts($1)
        end
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.13963636363636364, 'fraction_numerical': 0.0014545454545454545, 'mean_word_length': 2.2149532710280373, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4186014', 'n_tokens_mistral': 464, 'n_tokens_neox': 448, 'n_words': 109}