fix(scanner): fix watcher panic

This commit is contained in:
Dmitry Rubtsov
2023-02-17 17:33:32 +06:00
committed by sentriz
parent 19be6f0881
commit 78d0c52d22

View File

@@ -186,7 +186,10 @@ func (s *Scanner) ExecuteWatch() error {
t.Reset(10 * time.Second)
}
fileInfo, err := os.Stat(event.Name)
if err != nil && fileInfo.IsDir() {
if err != nil {
break
}
if fileInfo.IsDir() {
dirName = event.Name
} else {
dirName = filepath.Dir(event.Name)