iotop: backport some bugfix patches Signed-off-by: Zhiqiang Liu <liuzhiqiang26@huawei.com>
55 lines
1.9 KiB
Diff
55 lines
1.9 KiB
Diff
From 8b0d74472fccdff449bf83d7624df0867df83344 Mon Sep 17 00:00:00 2001
|
|
From: Paul Wise <pabs3@bonedaddy.net>
|
|
Date: Thu, 4 Aug 2016 17:28:57 +0800
|
|
Subject: [PATCH 08/11] Print the titles at specific locations
|
|
|
|
Prevents a crash in a 3-line terminal:
|
|
|
|
Traceback (most recent call last):
|
|
File "./iotop.py", line 12, in <module>
|
|
main()
|
|
File "./iotop/ui.py", line 652, in main
|
|
main_loop()
|
|
File "./iotop/ui.py", line 642, in <lambda>
|
|
main_loop = lambda: run_iotop(options)
|
|
File "./iotop/ui.py", line 537, in run_iotop
|
|
return curses.wrapper(run_iotop_window, options)
|
|
File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
|
|
return func(stdscr, *args, **kwds)
|
|
File "./iotop/ui.py", line 529, in run_iotop_window
|
|
ui.run()
|
|
File "./iotop/ui.py", line 176, in run
|
|
self.process_list.duration)
|
|
File "./iotop/ui.py", line 492, in refresh_display
|
|
self.win.addstr(title, attr)
|
|
_curses.error: addstr() returned ERR
|
|
---
|
|
iotop/ui.py | 4 +++-
|
|
1 file changed, 3 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/iotop/ui.py b/iotop/ui.py
|
|
index e033c92..848c42b 100644
|
|
--- a/iotop/ui.py
|
|
+++ b/iotop/ui.py
|
|
@@ -452,6 +452,7 @@ class IOTopUI(object):
|
|
self.win.addstr(i, 0, s[:self.width])
|
|
self.win.hline(len(summary), 0, ord(' ') | curses.A_REVERSE,
|
|
self.width)
|
|
+ pos = 0
|
|
remaining_cols = self.width
|
|
for i in range(len(titles)):
|
|
attr = curses.A_REVERSE
|
|
@@ -463,7 +464,8 @@ class IOTopUI(object):
|
|
title += self.sorting_reverse and '>' or '<'
|
|
title = title[:remaining_cols]
|
|
remaining_cols -= len(title)
|
|
- self.win.addstr(title, attr)
|
|
+ self.win.addstr(len(summary), pos, title, attr)
|
|
+ pos += len(title)
|
|
if Stats.has_blkio_delay_total:
|
|
status_msg = None
|
|
else:
|
|
--
|
|
1.8.3.1
|
|
|