I ran into a problem caused by an oddly named directory which resulted in the inotify backend for guard reliably crashing out on a rails project.
The follow snippet demonstrates the issue:
listener = INotify::Notifier.new
listener.watch("test-1", :all_events, :recursive) do |event|
When it encounters a directory named '**', the current code (using Dir.glob) enters an infinite, recursive loop until it throws a SystemStackError, because the directory name is a self-matching glob pattern.
As the code in #watch is only using Dir.glob as a convenient way to get a path, rather than just a list of leafnames, I figure the best solution is to switch to Dir.new?
Avoid needing to escape glob patterns in directory names