Skip to content

Commit

Permalink
Merge pull request #942 from r4f4/fix-filetop
Browse files Browse the repository at this point in the history
filetop: Fix TypeError by not mixing bytes and str.
  • Loading branch information
drzaeus77 committed Feb 14, 2017
2 parents 9da5a97 + 2939265 commit e105d53
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions tools/filetop.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ def signal_ignore(signal, frame):
line = 0
for k, v in reversed(sorted(counts.items(),
key=lambda counts: counts[1].rbytes)):
name = k.name
name = k.name.decode()
if k.name_len > DNAME_INLINE_LEN:
name = name[:-3] + "..."

# print line
print("%-6d %-16s %-6d %-6d %-7d %-7d %1s %s" % (k.pid, k.comm,
v.reads, v.writes, v.rbytes / 1024, v.wbytes / 1024, k.type,
name))
print("%-6d %-16s %-6d %-6d %-7d %-7d %1s %s" % (k.pid,
k.comm.decode(), v.reads, v.writes, v.rbytes / 1024,
v.wbytes / 1024, k.type.decode(), name))

line += 1
if line >= maxrows:
Expand Down

0 comments on commit e105d53

Please sign in to comment.