Trigger reload if event time is equal to or later than file modified time

This covers the case when editing the same file several times, as event time and file modified time often has the same value when this code is reached.
This commit is contained in:
Morten Slaatten Berg 2017-12-21 10:55:37 +01:00
parent 005494afc1
commit 406658de13

View File

@ -308,7 +308,7 @@ L:
if fi.IsDir() {
filepath.Walk(event.Name, p.walk)
} else {
if event.Op != fsnotify.Write || (eventTime.Truncate(time.Millisecond).After(fi.ModTime().Truncate(time.Millisecond)) || event.Name != p.lastFile) {
if event.Op != fsnotify.Write || (!eventTime.Truncate(time.Millisecond).Before(fi.ModTime().Truncate(time.Millisecond)) || event.Name != p.lastFile) {
// stop and restart
close(p.stop)
p.stop = make(chan bool)