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:
parent
005494afc1
commit
406658de13
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user