]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
tools: Support restrictive terminals with cell stats
authorJan Kiszka <jan.kiszka@siemens.com>
Tue, 11 Nov 2014 16:13:46 +0000 (17:13 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Fri, 21 Nov 2014 19:34:32 +0000 (20:34 +0100)
Some terminals may not support use_default_colors or curs_set and throw
an exception at us. Seen with serial consoles. However, the stats
command can still work if they fail, so ignore those errors.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
tools/jailhouse-cell-stats

index 2b285e3d30de177749307682764df68378473e9a..075e7a5bed605868635a0baea0c8d65d28bfa263 100755 (executable)
@@ -20,9 +20,12 @@ stats_dir = "/sys/devices/jailhouse/cells/%s/statistics"
 
 
 def main(stdscr, cell, stats_names):
-    curses.use_default_colors()
+    try:
+        curses.use_default_colors()
+        curses.curs_set(0)
+    except curses.error:
+        pass
     curses.noecho()
-    curses.curs_set(0)
     curses.halfdelay(10)
     value = dict.fromkeys(stats_names)
     old_value = dict.fromkeys(stats_names, None)