mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-08-02 15:03:25 +02:00
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:
@@ -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})")
|
||||
|
||||
Reference in New Issue
Block a user