Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

watchfs

Directory watcher. It watches a path with the C_FS gclass and runs a shell command whenever a matching file changes. Handy for auto-rebuild / auto-reload loops during development.

Architecture

C_WATCHFS
    C_FS      <- filesystem watch (emits EV_FS_CHANGED / EV_FS_RENAMED)
    C_TIMER

C_FS watches path (optionally the whole subtree) and emits EV_FS_CHANGED and EV_FS_RENAMED. C_WATCHFS filters the event’s filename against the patterns (a list of POSIX regular expressions, compiled with regcomp) and, on a match, runs command.

Configuration

AttributeDefaultPurpose
pathDirectory to watch
recursivefalseWatch the whole directory tree
patternsList of POSIX regex; only matching filenames trigger command
commandShell command to run on a matching event
use_parameterfalseAppend the changed filename as an argument to command
ignore_changed_eventfalseIgnore EV_FS_CHANGED
ignore_renamed_eventfalseIgnore EV_FS_RENAMED
infofalseLog discovered subdirectories

Commands

CommandDescription
helpCommand help

Debugging

GClassLevelShows
C_WATCHFStrace_userWatch/match/exec activity

Enable with ycommand command-yuno id=<id> service=__yuno__ command=set-gclass-trace gclass=C_WATCHFS set=1 level=trace_user.