Do not crash when failing to read an entry (#1090)
This commit is contained in:
parent
8ea13474a6
commit
4c4a51cb6b
3
black.py
3
black.py
@ -3491,6 +3491,9 @@ def gen_python_files_in_dir(
|
|||||||
# Then ignore with `exclude` option.
|
# Then ignore with `exclude` option.
|
||||||
try:
|
try:
|
||||||
normalized_path = "/" + child.resolve().relative_to(root).as_posix()
|
normalized_path = "/" + child.resolve().relative_to(root).as_posix()
|
||||||
|
except OSError as e:
|
||||||
|
report.path_ignored(child, f"cannot be read because {e}")
|
||||||
|
continue
|
||||||
except ValueError:
|
except ValueError:
|
||||||
if child.is_symlink():
|
if child.is_symlink():
|
||||||
report.path_ignored(
|
report.path_ignored(
|
||||||
|
Loading…
Reference in New Issue
Block a user