Method: EasyType::Daemon#sync

Defined in:
lib/easy_type/daemon.rb

#sync(timeout = TIMEOUT, &proc) ⇒ Object

Wait for the daemon process to return a valid sync string. YIf your command passed ,return the string ‘~~~~COMMAND SUCCESFULL~~~~’. If it failed, return the string ‘~~~~COMMAND FAILED~~~~’



60
61
62
63
64
65
66
67
68
# File 'lib/easy_type/daemon.rb', line 60

def sync( timeout = TIMEOUT, &proc)
  while true do
    line = timed_readline(timeout)
    Puppet.debug "#{line}"
    break if line =~ SUCCESS_SYNC_STRING
    fail 'command in deamon failed.' if line =~ FAILED_SYNC_STRING
    proc.call(line) if proc
  end
end