Class: Listen::Adapter::Linux

Inherits:
Base
  • Object
show all
Defined in:
lib/listen/adapter/linux.rb

Overview

Listener implementation for Linux inotify.

Constant Summary collapse

EVENTS =

Watched inotify events

[:recursive, :attrib, :create, :delete, :move, :close_write]
INOTIFY_LIMIT_MESSAGE =

The message to show when the limit of inotify watchers is not enough

"  Listen error: unable to monitor directories for changes.\n\n  Please head to https://github.com/guard/listen/wiki/Increasing-the-amount-of-inotify-watchers\n  for information on how to solve this issue.\n".gsub(/^\s*/, '')

Constants inherited from Base

Base::DEFAULT_LATENCY

Instance Attribute Summary

Attributes inherited from Base

#listener

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(listener) ⇒ Linux



27
28
29
30
# File 'lib/listen/adapter/linux.rb', line 27

def initialize(listener)
  require 'rb-inotify'
  super
end

Class Method Details

.usable?Boolean



23
24
25
# File 'lib/listen/adapter/linux.rb', line 23

def self.usable?
  RbConfig::CONFIG['target_os'] =~ /linux/i
end

Instance Method Details

#startObject



32
33
34
35
36
37
# File 'lib/listen/adapter/linux.rb', line 32

def start
  worker = _init_worker
  worker.run
rescue Errno::ENOSPC
  abort(INOTIFY_LIMIT_MESSAGE)
end