guard/guard — Issue #183: Temporarily pausing watcher during task execution
Author: cpjolicoeur
Created: 2011-11-24 15:53:52+00:00
State: open

I am the maintainer of guard-annotate and I'm not familiar enough with guards internals to solve a problem.

Right now, guard-annotate will get stuck in an endless loop while monitoring a specific file (config/routes.rb in a rails application). The issue is that we are watching the file for changes, which will kick off a process that annotates those changes in the same file.

So, guard notices a change to the file, then kicks off a shell script in response which in turn, makes more changes to that same file -- which guard notices as a change and starts the process again, continuously looping.

I tried finding a way by looking through the guard code to temporarily pause monitoring of files to prevent this issue but haven't found a solution. My last attempt involved wrapping my shell script call inside:

::Guard.listener.pause
... shell process here ...
::Guard.listener.run

but that doesnt seem to prevent the endless looping either.