51 lines
1.7 KiB
Diff
51 lines
1.7 KiB
Diff
|
|
From 529a74a28be43c04840d937c87a5ee3b81133852 Mon Sep 17 00:00:00 2001
|
||
|
|
From: Paul Wise <pabs3@bonedaddy.net>
|
||
|
|
Date: Thu, 4 Aug 2016 18:24:46 +0800
|
||
|
|
Subject: [PATCH] Check the column title is not empty before using it
|
||
|
|
|
||
|
|
Fixes crash with terminals that don't fit all titles.
|
||
|
|
|
||
|
|
Traceback (most recent call last):
|
||
|
|
File "./iotop.py", line 12, in <module>
|
||
|
|
main()
|
||
|
|
File "./iotop/ui.py", line 669, in main
|
||
|
|
main_loop()
|
||
|
|
File "./iotop/ui.py", line 659, in <lambda>
|
||
|
|
main_loop = lambda: run_iotop(options)
|
||
|
|
File "./iotop/ui.py", line 554, in run_iotop
|
||
|
|
return curses.wrapper(run_iotop_window, options)
|
||
|
|
File "/usr/lib/python3.5/curses/__init__.py", line 94, in wrapper
|
||
|
|
return func(stdscr, *args, **kwds)
|
||
|
|
File "./iotop/ui.py", line 546, in run_iotop_window
|
||
|
|
ui.run()
|
||
|
|
File "./iotop/ui.py", line 176, in run
|
||
|
|
self.process_list.duration)
|
||
|
|
File "./iotop/ui.py", line 515, in refresh_display
|
||
|
|
self.win.addstr(len_summary, pos, title, attr)
|
||
|
|
_curses.error: addwstr() returned ERR
|
||
|
|
|
||
|
|
|
||
|
|
Conflict: NA
|
||
|
|
Reference: https://repo.or.cz/iotop.git/commit/529a74a28be43c04840d937c87a5ee3b81133852
|
||
|
|
---
|
||
|
|
iotop/ui.py | 3 ++-
|
||
|
|
1 file changed, 2 insertions(+), 1 deletion(-)
|
||
|
|
|
||
|
|
diff --git a/iotop/ui.py b/iotop/ui.py
|
||
|
|
index 30efa73..a957bdd 100644
|
||
|
|
--- a/iotop/ui.py
|
||
|
|
+++ b/iotop/ui.py
|
||
|
|
@@ -511,7 +511,8 @@ class IOTopUI(object):
|
||
|
|
title += self.sorting_reverse and '>' or '<'
|
||
|
|
title = title[:remaining_cols]
|
||
|
|
remaining_cols -= len(title)
|
||
|
|
- self.win.addstr(len_summary, pos, title, attr)
|
||
|
|
+ if title:
|
||
|
|
+ self.win.addstr(len_summary, pos, title, attr)
|
||
|
|
pos += len(title)
|
||
|
|
for i in range(num_lines):
|
||
|
|
try:
|
||
|
|
--
|
||
|
|
2.33.0
|
||
|
|
|