From e1563f9d175026488a36d52a6ffcfb6745d56644 Mon Sep 17 00:00:00 2001 From: John Estabrook Date: Tue, 27 Apr 2021 12:17:25 -0500 Subject: op-mode: T2946: only call 'stty size' if in terminal --- src/op_mode/show_interfaces.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/op_mode/show_interfaces.py b/src/op_mode/show_interfaces.py index 39e5dc7ac..20d5d9e17 100755 --- a/src/op_mode/show_interfaces.py +++ b/src/op_mode/show_interfaces.py @@ -26,7 +26,7 @@ import netifaces from vyos.ifconfig import Section from vyos.ifconfig import Interface from vyos.ifconfig import VRRP -from vyos.util import cmd +from vyos.util import cmd, call # interfaces = Sections.reserved() @@ -95,6 +95,10 @@ def split_text(text, used=0): text: the string to split used: number of characted already used in the screen """ + no_tty = call('tty -s') + if no_tty: + return text.split() + returned = cmd('stty size') if len(returned) == 2: rows, columns = [int(_) for _ in returned] -- cgit v1.2.3