fsevent in the background

I'm trying to use the Daemons gem to daemonize a process in the background.This process just checks for any change in a directory and reports it. I've used the Daemons gem before and never really ran into any problems, however when I mix it with the rb-fsevent directory monitoring, something seems to go wrong.

Here's the ruby code that monitors the directory change,

require 'rb-fsevent'
require 'rubygems'

notifier = FSEvent.new
notifier.watch "/Test/NewFolder" do |directories|
  puts "Detected change inside: #{directories.inspect}"
end
notifier.run

And here's how I'm calling the ruby file,

require 'rubygems'
require 'daemons'

Daemons.run('folder_watcher_mac.rb')

When I run "ruby start_watcher.rb start" nothing is happening. Is this the right way to daemonize the rb-fsevent?

链接地址: http://www.djcxy.com/p/25374.html

上一篇: 用于验证值列表的javax.validation?

下一篇: fsevent在后台