class Guard::Runner

def _supervise(plugin, task, *args)

Raises:
  • (:task_has_failed) - when task has failed

Parameters:
  • args (Array) -- the arguments for the task
  • task (Symbol) -- the task to run
  • plugin (Guard::Plugin) -- guard the Guard to execute
def _supervise(plugin, task, *args)
  catch self.class.stopping_symbol_for(plugin) do
    plugin.hook("#{ task }_begin", *args)
    result = UI.options.with_progname(plugin.class.name) do
      begin
        plugin.send(task, *args)
      rescue Interrupt
        throw(:task_has_failed)
      end
    end
    plugin.hook("#{ task }_end", result)
    result
  end
rescue ScriptError, StandardError, RuntimeError
  UI.error("#{ plugin.class.name } failed to achieve its"\
                    " <#{ task }>, exception was:" \
                    "\n#{ $!.class }: #{ $!.message }" \
                    "\n#{ $!.backtrace.join("\n") }")
  Guard.state.session.plugins.remove(plugin)
  UI.info("\n#{ plugin.class.name } has just been fired")
  $!
end