lib/rb-fsevent/fsevent.rb in rb-fsevent-0.9.5 vs lib/rb-fsevent/fsevent.rb in rb-fsevent-0.9.6

- old
+ new

@@ -50,15 +50,24 @@ stop end def stop unless @pipe.nil? - Process.kill('KILL', @pipe.pid) + Process.kill('KILL', @pipe.pid) if process_running?(@pipe.pid) @pipe.close end rescue IOError ensure @running = false + end + + def process_running?(pid) + begin + Process.kill(0, pid) + true + rescue Errno::ESRCH + false + end end if RUBY_VERSION < '1.9' def open_pipe IO.popen("'#{self.class.watcher_path}' #{options_string} #{shellescaped_paths}")