Correct issue if process has no user name.

pull/2196/head
Nicolas Hennion 2022-11-16 14:47:40 +01:00 committed by GitHub
parent 4cd3c57c24
commit a45242138c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -53,7 +53,7 @@ def processes_to_programs(processes):
programs_dict[p[key]]['childrens'].append(p['pid'])
# If all the subprocess has the same value, display it
programs_dict[p[key]]['username'] = (
p['username'] if p['username'] == programs_dict[p[key]]['username'] else '_'
p['username'] if ('username' in p) and (p['username'] == programs_dict[p[key]]['username']) else '_'
)
programs_dict[p[key]]['nice'] = p['nice'] if p['nice'] == programs_dict[p[key]]['nice'] else '_'
programs_dict[p[key]]['status'] = p['status'] if p['status'] == programs_dict[p[key]]['status'] else '_'