Skip to content

Commit

Permalink
PermissionError on macOS #1120
Browse files Browse the repository at this point in the history
  • Loading branch information
nicolargo committed Jul 8, 2017
1 parent 3d9b086 commit c011869
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions NEWS
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Bugs corrected:
* Potential memory leak in Windows WebUI (issue #1056)
* glances_network `OSError: [Errno 19] No such device` (issue #1106)
* GPU plugin. <class 'TypeError'>: ... not JSON serializable"> (issue #1112)
* PermissionError on macOS (issue #1120)

Installation:

Expand Down
5 changes: 3 additions & 2 deletions glances/processes.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,8 +240,9 @@ def __get_mandatory_stats(self, proc, procstat):
procstat.update(proc.as_dict(
attrs=['name', 'cpu_times', 'status', 'ppid'],
ad_value=''))
except psutil.NoSuchProcess:
except (psutil.NoSuchProcess, psutil.AccessDenied):
# Try/catch for issue #432 (process no longer exist)
# Try/catch for issue #1120 (only see on Macos)
return None
else:
procstat['status'] = str(procstat['status'])[:1].upper()
Expand All @@ -250,7 +251,7 @@ def __get_mandatory_stats(self, proc, procstat):
procstat.update(proc.as_dict(
attrs=['username', 'cpu_percent', 'memory_percent'],
ad_value=''))
except psutil.NoSuchProcess:
except (psutil.NoSuchProcess, psutil.AccessDenied):
# Try/catch for issue #432 (process no longer exist)
return None

Expand Down

0 comments on commit c011869

Please sign in to comment.