Skip to content

Commit

Permalink
Handle OSError when listing to get path with real case. Fixes #1154
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Dec 16, 2022
1 parent ed59c6d commit 66f85dc
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/debugpy/_vendored/pydevd/pydevd_file_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,18 @@ def _resolve_listing_parts(resolved, parts_in_lowercase, filename):
pydev_log.exception()
# Don't fail, just return the original file passed.
return filename
except OSError:
# Something as: PermissionError (listdir may fail).
# See: https://github.com/microsoft/debugpy/issues/1154
# Don't fail nor log unless the trace level is at least info. Just return the original file passed.
if DebugInfoHolder.DEBUG_TRACE_LEVEL >= 1:
pydev_log.info(
'pydev debugger: OSError: Unable to get real case for file. Details:\n'
'filename: %s\ndrive: %s\nparts: %s\n',
filename, resolved, parts_in_lowercase
)
pydev_log.exception()
return filename


if sys.platform == 'win32':
Expand Down

0 comments on commit 66f85dc

Please sign in to comment.