From 85d42d9ffe702b64717ffab1b26304348e3f101e Mon Sep 17 00:00:00 2001 From: MarekWo Date: Fri, 9 Jan 2026 18:56:57 +0100 Subject: [PATCH] fix: Set terminal env vars to prevent os.get_terminal_size() errors meshcli calls os.get_terminal_size() which fails without a TTY. Setting COLUMNS, LINES, and TERM=dumb provides fallback values. Co-Authored-By: Claude Opus 4.5 --- meshcore-bridge/bridge.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/meshcore-bridge/bridge.py b/meshcore-bridge/bridge.py index 9f2a0ad..4a88e4a 100644 --- a/meshcore-bridge/bridge.py +++ b/meshcore-bridge/bridge.py @@ -90,13 +90,20 @@ class MeshCLISession: logger.info(f"Starting meshcli session on {self.serial_port}") try: + # Set terminal size env vars for meshcli (prevents os.get_terminal_size() errors) + env = os.environ.copy() + env['COLUMNS'] = '120' + env['LINES'] = '40' + env['TERM'] = 'dumb' + self.process = subprocess.Popen( ['meshcli', '-s', self.serial_port], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, - bufsize=1 # Line-buffered + bufsize=1, # Line-buffered + env=env ) logger.info(f"meshcli process started (PID: {self.process.pid})")