8 Star 0 Fork 4

src-anolis-os/tuna

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
tuna-Fix-show_threads-cgroup-without-a-term.patch 1.26 KB
一键复制 编辑 原始数据 按行查看 历史
小龙 提交于 2023-05-16 22:25 . update to tuna-0.18-6.el8
From 613bc73f6ad821db682e9efc097c29af9cb40858 Mon Sep 17 00:00:00 2001
From: Leah Leshchinsky <[email protected]>
Date: Wed, 23 Nov 2022 14:14:36 -0500
Subject: [PATCH] tuna: Fix --show_threads --cgroup 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 <[email protected]>
- Edited the commit title
- Edited the description
Signed-off-by: John Kacur <[email protected]>
diff --git a/tuna-cmd.py b/tuna-cmd.py
index 54dc567..f5dafa7 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):
@@ -353,9 +354,10 @@ 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()
+ 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
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/src-anolis-os/tuna.git
[email protected]:src-anolis-os/tuna.git
src-anolis-os
tuna
tuna
a8

搜索帮助