From 263e0c03308daa98b405d422c9cb085ec32ff960 Mon Sep 17 00:00:00 2001 From: Arthur Leonard Andersen Date: Sun, 17 Dec 2017 12:23:56 +0100 Subject: [PATCH] Fix multiple runs after multiple watcher invokations Given a guard config like this: ``` guard 'rake', task: 'load', run_on_start: false do watch(%r{.+}) end ``` Before the behavior was: * First change of watched file, task is executed once * Second change of watched file, task is executed twice simultaneously * Third change of watched file, task is executed thrice simultaneously The expected new behavior is: Task is executed once, at every change. --- lib/guard/rake.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/guard/rake.rb b/lib/guard/rake.rb index b7dbad8..2dbdb39 100644 --- a/lib/guard/rake.rb +++ b/lib/guard/rake.rb @@ -51,7 +51,7 @@ def run_on_modifications(paths) def run_rake_task(paths=[]) UI.info "running #{@task}" - ::Rake::Task.tasks.each { |t| t.reenable } + ::Rake::Task[@task].reenable ::Rake::Task[@task].invoke(*@options[:task_args], paths) Notifier.notify(