howeyc / fsnotify

File system notification for Go
BSD 3-Clause "New" or "Revised" License
1.99k stars 252 forks source link

short read in readEvents on Windows 2008 server #122

Open max201920 opened 5 years ago

max201920 commented 5 years ago

While reading file from a network drive we are getting below error.

short read in readEvents on what changes needs to be done on networkDrive permission to get rid of this issue? it is working fine with windows inbuild drive (i.e. C: / D: )

My Code is as follows.

package main

import (
    "fmt"
    "log"
    "os"
    "time"

    "github.com/howeyc/fsnotify"
)

func main() {
    fmt.Println("hello world")
    watcher, err := fsnotify.NewWatcher()
    if err != nil {
        log.Fatal(err)
    }

    go func() {
        for {
            select {
            case ev := <-watcher.Event:
                log.Println("Custom:", ev)
                log.Println("event:", ev)
            case err := <-watcher.Error:
                log.Println("error:", err)
            }
        }
    }()

    err = watcher.Watch(os.Args[1])
    if err != nil {
        log.Fatal(err)

    }

    time.Sleep(2 * time.Hour)
}
nathany commented 5 years ago

This issue still exists in the latest version of fsnotify (see fork): https://github.com/fsnotify/fsnotify/issues/72