Apply patch by mostroski to commands/proc.py which fixes exception if

a process is run with a nonexistant uid.  When listing processes
running in a cpuset, the patch tries to lookup the user name by uid,
and if the uid does not exist in /etc/passwd, the uid is printed
instead of the user name.
python3
Alex Tsariounov 14 years ago
parent ef072838bc
commit afa3d3943d

@ -713,7 +713,11 @@ def task_detail(pid, width=70):
cmdline = cmdline.replace('\0', ' ')
out = []
out.append(pwd.getpwuid(int(stdict['Uid'].split()[0]))[0][:8].ljust(8))
try:
uid=pwd.getpwuid(int(stdict['Uid'].split()[0]))[0][:8].ljust(8)
except:
uid=stdict['Uid'].split()[0][:8].ljust(8)
out.append(uid)
out.append(stdict['Pid'].rjust(5))
out.append(stdict['PPid'].rjust(5))

Loading…
Cancel
Save