MCPcopy Index your code
hub / github.com/coder/coder / NewFSNotify

Function NewFSNotify

agent/agentcontainers/watcher/watcher.go:50–61  ·  view source on GitHub ↗

NewFSNotify creates a new file system watcher that watches parent directories instead of individual files for more reliable event detection.

()

Source from the content-addressed store, hash-verified

48// NewFSNotify creates a new file system watcher that watches parent directories
49// instead of individual files for more reliable event detection.
50func NewFSNotify() (Watcher, error) {
51 w, err := fsnotify.NewWatcher()
52 if err != nil {
53 return nil, xerrors.Errorf("create fsnotify watcher: %w", err)
54 }
55 return &fsnotifyWatcher{
56 Watcher: w,
57 done: make(chan struct{}),
58 watchedFiles: make(map[string]bool),
59 watchedDirs: make(map[string]int),
60 }, nil
61}
62
63func (f *fsnotifyWatcher) Add(file string) error {
64 absPath, err := filepath.Abs(file)

Callers 3

NewAPIFunction · 0.92
TestFSNotifyWatcherFunction · 0.92

Calls 1

ErrorfMethod · 0.45

Tested by 2

TestFSNotifyWatcherFunction · 0.74