Skip to content

Commit 9a16171

Browse files
authored
Fix race condition in local ls() (#1744)
Fix #1742
1 parent 60eab20 commit 9a16171

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

fsspec/implementations/local.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ def ls(self, path, detail=False, **kwargs):
6060
info = self.info(path)
6161
if info["type"] == "directory":
6262
with os.scandir(path) as it:
63-
infos = [self.info(f) for f in it]
63+
infos = []
64+
for f in it:
65+
try:
66+
infos.append(self.info(f))
67+
except FileNotFoundError:
68+
pass
6469
else:
6570
infos = [info]
6671

0 commit comments

Comments
 (0)