diff --git a/lib/guard.rb b/lib/guard.rb index 426c761..68a03f3 100644 --- a/lib/guard.rb +++ b/lib/guard.rb @@ -59,8 +59,9 @@ module Guard # fire it if his work leads to a system failure def supervised_task(guard, task_to_supervise, *args) guard.hook "#{task_to_supervise.to_s}_begin" - guard.send(task_to_supervise, *args) + result = guard.send(task_to_supervise, *args) guard.hook "#{task_to_supervise.to_s}_end" + result rescue Exception UI.error("#{guard.class.name} guard failed to achieve its <#{task_to_supervise.to_s}> command: #{$!}") ::Guard.guards.delete guard diff --git a/lib/guard/guard.rb b/lib/guard/guard.rb index 812f72e..e952fe3 100644 --- a/lib/guard/guard.rb +++ b/lib/guard/guard.rb @@ -1,5 +1,6 @@ module Guard class Guard + include Hook attr_accessor :watchers, :options diff --git a/spec/guard_spec.rb b/spec/guard_spec.rb index 7997a18..89236a8 100644 --- a/spec/guard_spec.rb +++ b/spec/guard_spec.rb @@ -107,6 +107,8 @@ describe Guard do failing_result.message.should == 'I break your system' end end + + it "calls the default hooks" end describe ".locate_guard" do