Skip to content
This repository was archived by the owner on Jun 8, 2022. It is now read-only.
This repository was 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

@xym

Description

@xym
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()
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions