Method: UnisonCommand#execute

Defined in:
lib/unison.rb

#execute(dry_run = false) ⇒ Object

The method returns :success when all files are synchronized, :skipped when some files are skipped, :non_fatal_error when non fatal error occurs, and :fatal_error when fatal error occurs or process is interrupted. If dry_run is true, the method returns an array of a unison command to execute.



190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/unison.rb', line 190

def execute(dry_run = false)
  cmd = get_command
  if dry_run
    @status = nil
    return cmd
  end
  # Search exit code of unison command.
  Kernel.system(*cmd)
  case get_exit_status
  when 0
    :success
  when 1
    :skipped
  when 2
    :non_fatal_error
  when 3
    :fatal_error
  else
    raise StandardError, "Invalid exit code of unison: #{status.inspect.strip}."
  end
end