Comments (5)
I'll take a look. Assuming this is Linux?
But I'll check others to see if I can reproduce.
from fsnotify.
Hi,
I also encountered the same problems such,we do the test, all the normal,
but, the problem to coding listener, such as code:
package main
import (
"flag"
"log"
"net/http"
"github.com/howeyc/fsnotify"
)
func main(){
var httpListen = flag.String("http", "127.0.0.1:8080", "host:port to listen on")
watcher, err := fsnotify.NewWatcher()
defer watcher.Close()
if err != nil {
log.Fatal(err)
}
go func() {
for {
select {
case ev := <-watcher.Event:
log.Println("event:", ev)
case err := <-watcher.Error:
log.Println("error:", err)
}
}
}()
err = watcher.Watch("/home/myname")
if err != nil {
log.Fatal(err)
}
log.Printf("Open your web browser and visit http://%s/", *httpListen)
log.Fatal(http.ListenAndServe(*httpListen, nil))
}
Run it output:
2012/07/03 13:43:29 Open your web browser and visit http://127.0.0.1:8080/
2012/07/03 13:43:33 event: "/home/myname": CREATE
2012/07/03 13:43:33 event: "/home/myname": MODIFY
2012/07/03 13:43:33 event: "/home/myname": MODIFY
2012/07/03 13:43:45 event: "/home/myname": CREATE
2012/07/03 13:43:45 event: "/home/myname": MODIFY
2012/07/03 13:43:45 event: "/home/myname": MODIFY
2012/07/03 13:43:45 event: "/home/myname": MODIFY
gedit editor dir /home/myname one file, used two to save.......
Is this normal?or a problem with my program?
my OS is fedora17
Look forward to answering. thanks.
from fsnotify.
on Linux at least, the IN_MODIFY event AFAICS is working as expected. If you're only interested in the fact that someone just saved the file then you probably want to listen for IN_CLOSE_WRITE
from fsnotify.
My Linux 3.0 x64 and Win7 x64 machines at work yield double events. But on my Win7 x64 at home, it works great. I'll double chek my code. It's very possible I am doing something stupid!
Pithy comment here.
On Jul 2, 2012, at 6:04 PM, Chris [email protected] wrote:
I'll take a look. Assuming this is Linux?
But I'll check others to see if I can reproduce.
Reply to this email directly or view it on GitHub:
#10 (comment)
from fsnotify.
I get double events consistently on x64 Ubuntu 12.04 Go1 and "inotifywait" yields only 1 event for the same "event".
from fsnotify.
Related Issues (20)
- ln -sf only appears as DELETE on linux HOT 5
- Proper way to detect real rename HOT 4
- it is called twice when one file is modified in windows !! HOT 1
- NFS support HOT 2
- Single inotify instance with multiple watchers HOT 3
- 'done' channel in README not used HOT 3
- howeyc/fsnotify watch in window and linux problem, it‘s have some err HOT 8
- Not able to remove file watcher.
- Need an Operation for Linux - IN_CLOSE_WRITE HOT 1
- Unable to detect multiple files in directory. HOT 4
- Getting events only once. HOT 1
- Watching on network unit HOT 1
- Build fsnotify for s390x HOT 5
- short read in readEvents on Windows 2008 server HOT 1
- possible key buffer overflow when calling howeyc/fsnotify on Windows
- Editors on OSX result in random events HOT 9
- WatchFlags not supported on Windows? HOT 7
- Is it possible to watch a single file? HOT 1
- Git Tags? HOT 8
- Polling fallback HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fsnotify.