class

Pomtex::Watcher::Inotify

Inherits Reference < Object

Change notification through Linux inotify. Directories are watched rather than files: editors often save by writing a new file and renaming it over the old one, which would silently drop a watch on the file itself.

Constants

EVENT_HEADER = 16
NETWORK_FILESYSTEMS = {26985_u32, 20859_u32, 4283649346_u32, 4266872130_u32, 1702057286_u32, 16914839_u32, 1397113167_u32, 12805120_u32}

Remote and FUSE file systems don't report changes made elsewhere (NFS, SMB/CIFS, FUSE such as sshfs, 9p as used by WSL, AFS, Ceph).

Class methods

network?(dir : Path) : Bool
Source
open

nil when inotify is unavailable (another OS, or the instance limit is reached).

Source

Instance methods

close
Source
each_event

Yields each changed path as events arrive, or nil when the kernel queue overflowed and events were lost. Blocks only the calling fiber.

Source
watch(paths : Enumerable(Path)) : Array(Path)

Watches the directories of paths, dropping directories no longer needed. Returns the paths inotify can't cover; the caller should poll those.

Source