From 5b51172ec750293b1af3fa1e6d1cd6dd47875f6d Mon Sep 17 00:00:00 2001 From: Vasily Evseenko Date: Mon, 8 Apr 2024 20:28:14 +0300 Subject: [PATCH] Fix issue with termios and python < 3.11 --- wfb_ng/cli.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wfb_ng/cli.py b/wfb_ng/cli.py index a68ad88..801d11c 100644 --- a/wfb_ng/cli.py +++ b/wfb_ng/cli.py @@ -24,6 +24,8 @@ import msgpack import tempfile import signal import termios +import struct +import fcntl from twisted.python import log from twisted.internet import reactor, defer @@ -165,7 +167,8 @@ class AntennaStatClientFactory(ReconnectingClientFactory): def init_windows(self): self.windows.clear() - height, width = termios.tcgetwinsize(1) + # python < 3.11 doesn't have termios.tcgetwinsize + height, width = struct.unpack('hh', fcntl.ioctl(1, termios.TIOCGWINSZ, b' ' * 4)) curses.resize_term(height, width) self.stdscr.clear()