engine: resources: Let the user race me

If a user is racing the file resource, don't error permanently, just
skip the file that vanished, and move on with your life.
This commit is contained in:
James Shubin
2025-05-08 23:11:51 -04:00
parent fddebb2474
commit 7afa372765

View File

@@ -1834,7 +1834,12 @@ func ReadDir(path string) ([]FileInfo, error) {
}
fileInfo, err := file.Info()
if err != nil {
if os.IsNotExist(err) {
// File vanished before we could run Info() on it. This
// can happen if someone deletes a file in a directory
// while we're in the middle of running this. So skip...
continue
} else if err != nil {
return nil, errwrap.Wrapf(err, "unhandled error in FileInfo")
}