Skip to content

Commit

Permalink
Return unique filenames from Linux listener
Browse files Browse the repository at this point in the history
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/
  • Loading branch information
Marian Schubert committed Jan 26, 2011
1 parent 260c09a commit 9ff627c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions lib/guard/listeners/linux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ def watch_change
update_last_event

unless files.empty?
files.uniq!
files.map! { |file| file.gsub("#{Dir.pwd}/", '') }
callback.call(files)
files.clear
Expand Down

0 comments on commit 9ff627c

Please sign in to comment.