Skip to content

Commit

Permalink
Merge pull request #257 from guard/fix_fsevent_dir_bug
Browse files Browse the repository at this point in the history
Avoid reusing FSEvent obj so multiple dirs work
  • Loading branch information
e2 committed Sep 26, 2014
2 parents cea4489 + b869d33 commit 68cf9ee
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/listen/adapter/darwin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,16 @@ class Darwin < Base

def _configure(dir, &callback)
require 'rb-fsevent'
@worker ||= FSEvent.new
opts = { latency: options.latency }
@worker.watch(dir.to_s, opts, &callback)

@workers ||= Queue.new
@workers << FSEvent.new.tap do |worker|
worker.watch(dir.to_s, opts, &callback)
end
end

def _run
@worker.run
@workers.pop.run while !@workers.empty?
end

def _process_event(dir, event)
Expand Down

0 comments on commit 68cf9ee

Please sign in to comment.