class RuboCop::Server::ClientCommand::Base

@api private
Abstract base class for server client command.

def check_running_server

def check_running_server
  Server.running?.tap do |running|
    warn 'RuboCop server is not running.' unless running
  end
end

def run

def run
  raise NotImplementedError
end

def send_request(command:, args: [], body: '')

def send_request(command:, args: [], body: '')
  TCPSocket.open('127.0.0.1', Cache.port_path.read) do |socket|
    socket.puts [Cache.token_path.read, Dir.pwd, command, *args].shelljoin
    socket.write body
    socket.close_write
    $stdout.write socket.readpartial(4096) until socket.eof?
  end
end