Skip to content

Commit 0ab2f97

Browse files
committed
Fix case with no processes left after filtering by user.
1 parent 52ea107 commit 0ab2f97

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

nvidia-htop.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,10 @@ def colorize(_lines):
195195
for field in fields:
196196
del field[idx]
197197

198+
if len(pid) == 0:
199+
print("| " + no_running_process + " " * (73 - len(no_running_process)) + " |")
200+
sys.exit()
201+
198202
max_pid_length = max(5, max([len(x) for x in pid]))
199203
format = ("| %3s %" + str(max_pid_length) + "s %8s %8s %5s %5s %9s %-" + str(command_length) + "." + str(command_length) + "s |")
200204

0 commit comments

Comments
 (0)