Skip to content
Snippets Groups Projects
Commit 709ba99a authored by Mark Haines's avatar Mark Haines
Browse files

Check that /proc/self/fd exists before listing it

parent 9e4dacd5
Branches
Tags
No related merge requests found
...@@ -130,6 +130,10 @@ def _process_fds(): ...@@ -130,6 +130,10 @@ def _process_fds():
counts = {(k,): 0 for k in TYPES.values()} counts = {(k,): 0 for k in TYPES.values()}
counts[("other",)] = 0 counts[("other",)] = 0
# Not every OS will have a /proc/self/fd directory
if not os.path.exists("/proc/self/fd"):
return counts
for fd in os.listdir("/proc/self/fd"): for fd in os.listdir("/proc/self/fd"):
try: try:
s = os.stat("/proc/self/fd/%s" % (fd)) s = os.stat("/proc/self/fd/%s" % (fd))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment