Skip to content

Commit 702c1e9

Browse files
committed
ignore some false positives when watching for changes (fixes gopherjs#191)
1 parent ec528d3 commit 702c1e9

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

build/build.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -567,11 +567,17 @@ func hasGopathPrefix(file, gopath string) (hasGopathPrefix bool, prefixLen int)
567567

568568
func (s *Session) WaitForChange() {
569569
s.options.PrintSuccess("watching for changes...\n")
570-
select {
571-
case ev := <-s.Watcher.Events:
572-
s.options.PrintSuccess("change detected: %s\n", ev.Name)
573-
case err := <-s.Watcher.Errors:
574-
s.options.PrintError("watcher error: %s\n", err.Error())
570+
for {
571+
select {
572+
case ev := <-s.Watcher.Events:
573+
if ev.Op&(fsnotify.Create|fsnotify.Write|fsnotify.Remove|fsnotify.Rename) == 0 || filepath.Base(ev.Name)[0] == '.' {
574+
continue
575+
}
576+
s.options.PrintSuccess("change detected: %s\n", ev.Name)
577+
case err := <-s.Watcher.Errors:
578+
s.options.PrintError("watcher error: %s\n", err.Error())
579+
}
580+
break
575581
}
576582

577583
go func() {

0 commit comments

Comments
 (0)