Merge pull request #33 from adamdecaf/watcher-break

watcher: properly break out in nested blocks
This commit is contained in:
Joel Speed 2019-01-31 09:54:17 +00:00 committed by GitHub
commit 787d3da9d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -45,7 +45,7 @@ func WatchForUpdates(filename string, done <-chan bool, action func()) {
select { select {
case _ = <-done: case _ = <-done:
log.Printf("Shutting down watcher for: %s", filename) log.Printf("Shutting down watcher for: %s", filename)
break return
case event := <-watcher.Events: case event := <-watcher.Events:
// On Arch Linux, it appears Chmod events precede Remove events, // On Arch Linux, it appears Chmod events precede Remove events,
// which causes a race between action() and the coming Remove event. // which causes a race between action() and the coming Remove event.