# File lib/listen/adapter.rb, line 168 def self.works?(directory, options = {}) work = false test_file = "#{directory}/.listen_test" callback = lambda { |*| work = true } adapter = self.new(directory, options, &callback) adapter.start(false) FileUtils.touch(test_file) t = Thread.new { sleep(adapter.latency * 5); adapter.stop } adapter.wait_for_callback work ensure Thread.kill(t) if t FileUtils.rm(test_file) if File.exists?(test_file) adapter.stop if adapter && adapter.started? end