From 7afa37276593c571418f718b2ce26a337f242e05 Mon Sep 17 00:00:00 2001 From: James Shubin Date: Thu, 8 May 2025 23:11:51 -0400 Subject: [PATCH] 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. --- engine/resources/file.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/engine/resources/file.go b/engine/resources/file.go index f00753d5..90c465bd 100644 --- a/engine/resources/file.go +++ b/engine/resources/file.go @@ -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") }