Return unique filenames from Linux listener

so that we don't get duplicate entries for same file. This solves problem with
commonly used Linux editors (e.g. Vim, Emacs) that generate multiple inotify
events on file save.

http://schettino72.wordpress.com/2010/03/07/inotify-text-editors-emacs-vim/
This commit is contained in:
Marian Schubert 2011-01-26 12:15:43 +00:00
parent 260c09a79f
commit 9ff627cfaa

View File

@ -60,6 +60,7 @@ module Guard
update_last_event update_last_event
unless files.empty? unless files.empty?
files.uniq!
files.map! { |file| file.gsub("#{Dir.pwd}/", '') } files.map! { |file| file.gsub("#{Dir.pwd}/", '') }
callback.call(files) callback.call(files)
files.clear files.clear