Sha256: 02cea9232a4063af63121402767e98dd3f40a4dba537a2ea66295e9562b4a4c9

Contents?: true

Size: 780 Bytes

Versions: 20

Compression:

Stored size: 780 Bytes

Contents

module Invoker
  class CLI::Tail
    attr_accessor :process_names
    def initialize(process_names)
      verify_process_name(process_names)
      @process_names = process_names
      @unix_socket = Invoker::IPC::UnixClient.new
    end

    def run
      socket = @unix_socket.send_and_wait('tail', process_names: process_names)
      trap('INT') { socket.close }
      loop do
        message = read_next_line(socket)
        break unless message
        puts message.tail_line
      end
    end

    private

    def verify_process_name(process_names)
      if process_names.empty?
        abort("Tail command requires one or more process name")
      end
    end

    def read_next_line(socket)
      Invoker::IPC.message_from_io(socket)
    rescue
      nil
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
itrg-invoker-1.6.1 lib/invoker/cli/tail.rb
itrg-invoker-1.6.0 lib/invoker/cli/tail.rb
invoker-1.5.8 lib/invoker/cli/tail.rb
invoker-1.5.7 lib/invoker/cli/tail.rb
invoker-1.5.6 lib/invoker/cli/tail.rb
invoker-1.5.5 lib/invoker/cli/tail.rb
invoker-1.5.4 lib/invoker/cli/tail.rb
invoker-1.5.3 lib/invoker/cli/tail.rb
meepo-1.5.2 lib/invoker/cli/tail.rb
invoker-1.5.1 lib/invoker/cli/tail.rb
invoker-1.4.1 lib/invoker/cli/tail.rb
invoker-1.4.0 lib/invoker/cli/tail.rb
invoker-1.3.2 lib/invoker/cli/tail.rb
invoker-1.3.1 lib/invoker/cli/tail.rb
invoker-1.3.0 lib/invoker/cli/tail.rb
invoker-1.2.0 lib/invoker/cli/tail.rb
invoker-1.2.0.pre2 lib/invoker/cli/tail.rb
invoker-1.2.0.pre1 lib/invoker/cli/tail.rb
invoker-1.2.0.pre lib/invoker/cli/tail.rb
invoker-1.1.0 lib/invoker/cli/tail.rb