summaryrefslogtreecommitdiff
path: root/src/op_mode/show_interfaces.py
diff options
context:
space:
mode:
authorJohn Estabrook <jestabro@vyos.io>2021-04-27 12:17:25 -0500
committerJohn Estabrook <jestabro@vyos.io>2021-04-27 13:48:03 -0500
commit64239f34960a6cb3825b3c3a564de5fd7f646390 (patch)
tree14a1475c97b857605874432b1ef1015ecf1463cd /src/op_mode/show_interfaces.py
parentbac0405f7828f14ce336c6a029612e05ae5abf53 (diff)
downloadvyos-1x-64239f34960a6cb3825b3c3a564de5fd7f646390.tar.gz
vyos-1x-64239f34960a6cb3825b3c3a564de5fd7f646390.zip
op-mode: T2946: only call 'stty size' if in terminal
(cherry picked from commit e1563f9d175026488a36d52a6ffcfb6745d56644)
Diffstat (limited to 'src/op_mode/show_interfaces.py')
-rwxr-xr-xsrc/op_mode/show_interfaces.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/op_mode/show_interfaces.py b/src/op_mode/show_interfaces.py
index de41274a7..79bb8e2a6 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()
@@ -86,6 +86,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]