#87 should be definitely fixed
This commit is contained in:
parent
fb1ebdfe4f
commit
5f1ca705e1
|
@ -61,9 +61,8 @@ L:
|
|||
select {
|
||||
case event := <-watcher.Events:
|
||||
if time.Now().Truncate(time.Second).After(p.lastChangedOn) {
|
||||
p.lastChangedOn = time.Now().Truncate(time.Second)
|
||||
if file, err := os.Lstat(event.Name); err == nil {
|
||||
if file.Size() > 0 {
|
||||
file, err := os.Lstat(event.Name)
|
||||
if (event.Op&fsnotify.Remove == fsnotify.Remove) || err == nil && file.Size() > 0 {
|
||||
p.lastChangedOn = time.Now().Truncate(time.Second)
|
||||
ext := filepath.Ext(event.Name)
|
||||
if inArray(ext, p.Watcher.Exts) {
|
||||
|
@ -77,7 +76,6 @@ L:
|
|||
p.stamp("log", out, msg, "")
|
||||
// check if is deleted
|
||||
if event.Op&fsnotify.Remove == fsnotify.Remove {
|
||||
watcher.Remove(event.Name)
|
||||
go p.routines(&wr, channel, watcher, "")
|
||||
} else {
|
||||
go p.routines(&wr, channel, watcher, event.Name)
|
||||
|
@ -86,7 +84,6 @@ L:
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
case err := <-watcher.Errors:
|
||||
msg = fmt.Sprintln(p.pname(p.Name, 2), ":", style.Red.Regular(err.Error()))
|
||||
out = BufferOut{Time: time.Now(), Text: err.Error()}
|
||||
|
|
Loading…
Reference in New Issue