Ignore updates for log file when watch is enabled (#2015)
* Ignore updates for log file when `watch` is enabled * Move check earlier * Ignore write event only * fix message
This commit is contained in:
1 parent
c3b184fc2e
commit
44e716d2f1
2 files changed
+16
-8
No files matched your search
@@ -96,6 +96,14 @@ func (watch *watch) loop() {
|
||||
}
|
||||
|
||||
if ev.Has(fsnotify.Write) || ev.Has(fsnotify.Chmod) {
|
||||
// skip write updates for the log file, otherwise it is possible
|
||||
// to have an infinite loop where writing to the log file causes
|
||||
// it to be reloaded, which in turn triggers more events that
|
||||
// are then logged
|
||||
if ev.Name == gLogPath && ev.Has(fsnotify.Write) {
|
||||
continue
|
||||
}
|
||||
|
||||
dir, file := filepath.Split(ev.Name)
|
||||
for _, path := range watch.getSameDirs(dir) {
|
||||
watch.addUpdate(filepath.Join(path, file))
|
||||
|
||||
Reference in new issue
Block a user