You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.
I was referring to the below example to get used to this module as I need to watch a repo file and based on events I need to perform certain actions:
Issue:
For testing, I am watching one file "/home/ankit/delta.txt".
The problem is that I receive events only first time if any modification is done to the file /home/ankit/delta.txt but after that I never receive any events, even If I access/remove/modify this file?
Output of my implementation:
2017/06/27 12:02:49 event: "/home/ankit/delta.txt": RENAME
2017/06/27 12:02:49 event: "/home/ankit/delta.txt": MODIFY|ATTRIB
2017/06/27 12:02:49 event: "/home/ankit/delta.txt": DELETE
My OS Details:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
done := make(chan bool)
// Process events
go func() {
for {
select {
case ev := <-watcher.Event:
log.Println("event:", ev)
case err := <-watcher.Error:
log.Println("error:", err)
}
}
}()
err = watcher.Watch("/home/ankit/delta.txt")
if err != nil {
log.Fatal(err)
}
// Hang so program doesn't exit
<-done
/* ... do stuff ... */
watcher.Close()
}
The text was updated successfully, but these errors were encountered:
I haven't been maintaining this for quite a while.
Anyway, to answer you question, If memory is correct, I believe a file is no longer watched once deleted. If you watch the folder you should get the create though.
My guess is the editor you are using for testing is doing some "magic" like renaming the file and overwriting the original or something.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hi,
I was referring to the below example to get used to this module as I need to watch a repo file and based on events I need to perform certain actions:
Issue:
For testing, I am watching one file "/home/ankit/delta.txt".
The problem is that I receive events only first time if any modification is done to the file /home/ankit/delta.txt but after that I never receive any events, even If I access/remove/modify this file?
Output of my implementation:
2017/06/27 12:02:49 event: "/home/ankit/delta.txt": RENAME
2017/06/27 12:02:49 event: "/home/ankit/delta.txt": MODIFY|ATTRIB
2017/06/27 12:02:49 event: "/home/ankit/delta.txt": DELETE
My OS Details:
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=14.04
DISTRIB_CODENAME=trusty
DISTRIB_DESCRIPTION="Ubuntu 14.04.5 LTS"
package main
import (
"log"
)
func main() {
watcher, err := fsnotify.NewWatcher()
if err != nil {
log.Fatal(err)
}
}
The text was updated successfully, but these errors were encountered: