Skip to content

Commit

Permalink
Fixes for a couple of more exception cases
Browse files Browse the repository at this point in the history
  • Loading branch information
John Pfuntner committed Apr 17, 2024
1 parent ca8a954 commit 96d893c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions bin/ps.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ def get_processes(self):
'session': self.int_or_none(stat_tokens, 5),
'tty_nr': self.int_or_none(stat_tokens, 6),
'tpgid': self.int_or_none(stat_tokens, 7),
'flags': '0x{:08x}'.format(int(stat_tokens[8])),
'flags': None if stat_tokens[8] is None else '0x{:08x}'.format(int(stat_tokens[8])),
'minflt': self.int_or_none(stat_tokens, 9),
'cminflt': self.int_or_none(stat_tokens, 10),
'majflt': self.int_or_none(stat_tokens, 11),
Expand Down Expand Up @@ -160,7 +160,7 @@ def get_processes(self):
'dt': self.int_or_none(statm_tokens, 6), # unused, always 0

'uid': uid,
'user': pwd.getpwuid(int(uid)).pw_name,
'user': uid if uid == '?' else pwd.getpwuid(int(uid)).pw_name,
'umask': status_dict.get('Umask'),
'vmpeak': status_dict.get('VmPeak'),
'vmsize': status_dict.get('VmSize'),
Expand Down

0 comments on commit 96d893c

Please sign in to comment.