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 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-01-09 18:56:57 +01:00
parent 2412df1d01
commit 85d42d9ffe
+8 -1
View File
@@ -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})")