File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -495,29 +495,35 @@ func (w *Watcher) retrieveFileList() map[string]os.FileInfo {
495495 if recursive {
496496 list , err = w .listRecursive (name )
497497 if err != nil {
498- if os .IsNotExist (err ) {
499- w .mu .Unlock ()
500- if name == err .(* os.PathError ).Path {
501- w .Error <- ErrWatchedFileDeleted
502- w .RemoveRecursive (name )
498+ e , ok := err .(syscall.Errno )
499+ if ok && e .Is (err ) {
500+ if os .IsNotExist (err ) {
501+ w .mu .Unlock ()
502+ if name == err .(* os.PathError ).Path {
503+ w .Error <- ErrWatchedFileDeleted
504+ w .RemoveRecursive (name )
505+ }
506+ w .mu .Lock ()
507+ } else {
508+ w .Error <- err
503509 }
504- w .mu .Lock ()
505- } else {
506- w .Error <- err
507510 }
508511 }
509512 } else {
510513 list , err = w .list (name )
511514 if err != nil {
512- if os .IsNotExist (err ) {
513- w .mu .Unlock ()
514- if name == err .(* os.PathError ).Path {
515- w .Error <- ErrWatchedFileDeleted
516- w .Remove (name )
515+ e , ok := err .(syscall.Errno )
516+ if ok && e .Is (err ) {
517+ if os .IsNotExist (err ) {
518+ w .mu .Unlock ()
519+ if name == err .(* os.PathError ).Path {
520+ w .Error <- ErrWatchedFileDeleted
521+ w .Remove (name )
522+ }
523+ w .mu .Lock ()
524+ } else {
525+ w .Error <- err
517526 }
518- w .mu .Lock ()
519- } else {
520- w .Error <- err
521527 }
522528 }
523529 }
You can’t perform that action at this time.
0 commit comments