Skip to content

Commit

Permalink
Fix race condition in local ls()
Browse files Browse the repository at this point in the history
Fix #1742
  • Loading branch information
Turakar authored Oct 31, 2024
1 parent 60eab20 commit 93d4739
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion fsspec/implementations/local.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ def ls(self, path, detail=False, **kwargs):
info = self.info(path)
if info["type"] == "directory":
with os.scandir(path) as it:
infos = [self.info(f) for f in it]
infos = []
for f in it:
try:
infos.append(self.info(f))
except FileNotFoundError:
pass
else:
infos = [info]

Expand Down

0 comments on commit 93d4739

Please sign in to comment.