Fix show_threads --cgroups run without a term
Resolves: rhbz#2121517 Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
This commit is contained in:
parent
c7df4867b4
commit
81f6bf0a66
|
@ -0,0 +1,42 @@
|
|||
From 4ccef8c2996e59e7031e77d7f8e2b42b73036210 Mon Sep 17 00:00:00 2001
|
||||
From: Leah Leshchinsky <lleshchi@redhat.com>
|
||||
Date: Wed, 23 Nov 2022 14:14:36 -0500
|
||||
Subject: [PATCH] tuna: Fix show_threads --cgroups run without a term
|
||||
|
||||
When tuna show_threads --cgroups is run without a term,
|
||||
provide a default column size of 80 to fix a traceback
|
||||
that occurred when querying the terminal size.
|
||||
|
||||
Signed-off-by: Leah Leshchinsky <lleshchi@redhat.com>
|
||||
- Edited the commit title
|
||||
- Edited the description
|
||||
Signed-off-by: John Kacur <jkacur@redhat.com>
|
||||
|
||||
diff --git a/tuna-cmd.py b/tuna-cmd.py
|
||||
index 630c8bc..4e809dd 100755
|
||||
--- a/tuna-cmd.py
|
||||
+++ b/tuna-cmd.py
|
||||
@@ -31,6 +31,7 @@ import procfs
|
||||
from tuna import tuna, sysfs
|
||||
import logging
|
||||
import time
|
||||
+import shutil
|
||||
|
||||
def get_loglevel(level):
|
||||
if level.isdigit() and int(level) in range(0,5):
|
||||
@@ -440,9 +441,10 @@ def ps_show(ps, affect_children, thread_list, cpu_list,
|
||||
|
||||
|
||||
# Width of terminal in columns
|
||||
- columns = None
|
||||
+ columns = 80
|
||||
if cgroups:
|
||||
- _, columns = os.popen('stty size', 'r').read().split()
|
||||
+ if os.isatty(sys.stdout.fileno()):
|
||||
+ columns = shutil.get_terminal_size().columns
|
||||
|
||||
for pid in ps_list:
|
||||
ps_show_thread(pid, affect_children, ps, has_ctxt_switch_info,
|
||||
--
|
||||
2.38.1
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
Name: tuna
|
||||
Version: 0.18
|
||||
Release: 11%{?dist}
|
||||
Release: 12%{?dist}
|
||||
License: GPLv2
|
||||
Summary: Application tuning GUI & command line utility
|
||||
URL: https://git.kernel.org/pub/scm/utils/tuna/tuna.git
|
||||
|
@ -25,6 +25,7 @@ Patch9: tuna-tuna.py-use-fstrings.patch
|
|||
Patch10: tuna-remove-import-and-fix-help-message.patch
|
||||
Patch11: tuna-Update-manpages-for-argparse-CLI-changes.patch
|
||||
Patch12: tuna-Adapt-show_threads-cgroup-output-to-terminal-si.patch
|
||||
Patch13: tuna-Fix-show_threads-cgroups-run-without-a-term.patch
|
||||
|
||||
%description
|
||||
Provides interface for changing scheduler and IRQ tunables, at whole CPU and at
|
||||
|
@ -78,6 +79,10 @@ done
|
|||
%{_datadir}/polkit-1/actions/org.tuna.policy
|
||||
|
||||
%changelog
|
||||
* Wed Nov 23 2022 Leah Leshchinsky <lleshchi@redhat.com> - 0.18-12
|
||||
- Fix show_threads --cgroups run without term
|
||||
Resolves: rhbz#2121517
|
||||
|
||||
* Fri Nov 18 2022 Leah Leshchinsky <lleshchi@redhat.com> - 0.18-11
|
||||
- Adapt show_threads cgroup output to terminal size
|
||||
Resolves: rhbz#2121517
|
||||
|
|
Loading…
Reference in New Issue