When process not run with terminal, no column information will be
available through 'stty' command.
Set default width to 80 to account for this condition.
Signed-off-by: Leah Leshchinsky <lleshchi(a)redhat.com>
---
target branch: getopt
diff --git a/tuna-cmd.py b/tuna-cmd.py
index 54dc567..accca4a 100755
--- a/tuna-cmd.py
+++ b/tuna-cmd.py
@@ -353,10 +353,11 @@ def ps_show(ps, affect_children, thread_list, cpu_list,
ps_list.sort()
# Width of terminal in columns
- columns = None
+ columns = 80
if cgroups:
- _, columns = os.popen('stty size', 'r').read().split()
-
+ size = os.popen('stty size', 'r').read().split()
+ if len(size) == 2:
+ _, columns = size
for pid in ps_list:
ps_show_thread(pid, affect_children, ps, has_ctxt_switch_info,
sock_inodes, sock_inode_re, cgroups, columns, compact)
--
2.38.1
Show replies by date