Skip to content

Commit f7c1bb6

Browse files
committed
update removeWatch
1 parent 9f852f6 commit f7c1bb6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

main.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,15 @@ func addWatch(root string, watcher *fsnotify.Watcher) {
189189

190190
func removeWatch(root string, watcher *fsnotify.Watcher) {
191191
filepath.Walk(root, func(path string, info os.FileInfo, err error) error {
192-
if info.IsDir() {
193-
log.Printf("[TRAC] Directory( %s )\n", path)
192+
193+
if err != nil {
194+
return err
195+
}
196+
197+
if info != nil {
198+
if info.IsDir() {
199+
log.Printf("[TRAC] Directory( %s )\n", path)
200+
}
194201
}
195202

196203
if err := watcher.Remove(path); err != nil {

0 commit comments

Comments
 (0)