Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

it is called twice when one file is modified in windows !! #106

Open
xym opened this issue Aug 18, 2014 · 1 comment
Open

it is called twice when one file is modified in windows !! #106

xym opened this issue Aug 18, 2014 · 1 comment

Comments

@xym
Copy link

xym commented Aug 18, 2014

package main

import (
    // "bytes"
    "fmt"
    "github.com/howeyc/fsnotify"
    "log"
    //"os/exec"
    //"strings"
)

func main() {
    watcher, err := fsnotify.NewWatcher()
    if err != nil {
        log.Fatal(err)
    }

    done := make(chan bool)

    // Process events
    go func() {
        for {
            select {

                        //  it is called twice when one file is modified in windows !!
            case ev := <-watcher.Event:
                        fmt.Println(ev)
            case err := <-watcher.Error:
                log.Println("error:", err)
            }
        }
    }()

    err = watcher.Watch("c:\\test")
    if err != nil {
        log.Fatal("not exists")

    }
    <-done

    watcher.Close()
}
@nathany
Copy link
Contributor

nathany commented Aug 18, 2014

@xym Thanks for reporting the issue.

Are you modifying the file in an editor? If so, it may be this issue: https://github.com/go-fsnotify/fsnotify/issues/17

Can you touch a file in Windows (perhaps in PowerShell?).

FYI, development of fsnotify has moved to: https://github.com/go-fsnotify/fsnotify. Though little has changed with the Windows support, so this is sure to still be an issue. 😦

Other issues tagged with Windows.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants