class Proclib::CommandMonitor

Watches the given command, emitting the appropriate events on the given channel when the command does something

Attributes

channel[R]
command[R]

Public Class Methods

new(command, channel:) click to toggle source
# File lib/proclib/command_monitor.rb, line 9
def initialize(command, channel:)
  @command, @channel = command, channel
end

Public Instance Methods

start() click to toggle source
# File lib/proclib/command_monitor.rb, line 13
def start
  io_handlers.each(&:start)
end
wait() click to toggle source
# File lib/proclib/command_monitor.rb, line 17
def wait
  io_handlers.each(&:wait)
end

Private Instance Methods

io_handlers() click to toggle source
# File lib/proclib/command_monitor.rb, line 23
def io_handlers
  @io_handlers ||= %i(stderr stdout).map do |type|
     OutputHandler.new(type, command, channel: channel)
  end
end