1
0
mirror of https://github.com/beego/bee.git synced 2024-11-22 10:10:53 +00:00

Merge pull request #333 from vCaesar/test-pr

Update fsnotify
This commit is contained in:
astaxie 2016-12-20 16:58:36 +08:00 committed by GitHub
commit a02243ba7a

View File

@ -24,7 +24,7 @@ import (
"sync" "sync"
"time" "time"
"github.com/howeyc/fsnotify" "github.com/fsnotify/fsnotify"
) )
var ( var (
@ -44,7 +44,7 @@ func NewWatcher(paths []string, files []string, isgenerate bool) {
go func() { go func() {
for { for {
select { select {
case e := <-watcher.Event: case e := <-watcher.Events:
isbuild := true isbuild := true
// Skip ignored files // Skip ignored files
@ -79,7 +79,7 @@ func NewWatcher(paths []string, files []string, isgenerate bool) {
AutoBuild(files, isgenerate) AutoBuild(files, isgenerate)
}() }()
} }
case err := <-watcher.Error: case err := <-watcher.Errors:
logger.Warnf("Watcher error: %s", err.Error()) // No need to exit here logger.Warnf("Watcher error: %s", err.Error()) // No need to exit here
} }
} }
@ -88,7 +88,7 @@ func NewWatcher(paths []string, files []string, isgenerate bool) {
logger.Info("Initializing watcher...") logger.Info("Initializing watcher...")
for _, path := range paths { for _, path := range paths {
logger.Infof(bold("Watching: ")+"%s", path) logger.Infof(bold("Watching: ")+"%s", path)
err = watcher.Watch(path) err = watcher.Add(path)
if err != nil { if err != nil {
logger.Fatalf("Failed to watch directory: %s", err) logger.Fatalf("Failed to watch directory: %s", err)
} }