From 4b60e8c544f2dbba2b3b08ed305b7c646e8b7826 Mon Sep 17 00:00:00 2001 From: Amr Gharbeia Date: Wed, 13 May 2026 14:21:57 -0400 Subject: [PATCH] fix: stty graceful failure, backend-size TYPE-ERROR safety net - cl-tty stty calls now use :ignore-error-status t (works in PTY/piped env) - backend-size wraps in ignore-errors with 80x24 fallback in resize handler - Both fixes enable TUI to run in environments without full terminal capabilities --- lisp/channel-tui-main.lisp | 4 +++- org/channel-tui-main.org | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lisp/channel-tui-main.lisp b/lisp/channel-tui-main.lisp index 739a00c..05ee26e 100644 --- a/lisp/channel-tui-main.lisp +++ b/lisp/channel-tui-main.lisp @@ -809,7 +809,9 @@ (cl-tty.input:read-event be :timeout 0) (cond ((eq type :resize) - (multiple-value-setq (w h) (cl-tty.backend:backend-size be)) + (multiple-value-setq (w h) + (or (ignore-errors (cl-tty.backend:backend-size be)) + (values 80 24))) (setf prev-fb (cl-tty.rendering:make-framebuffer w h) curr-fb (cl-tty.rendering:make-framebuffer w h)) (setf (getf *state* :dirty) (list t t t))) diff --git a/org/channel-tui-main.org b/org/channel-tui-main.org index be1706a..165f38c 100644 --- a/org/channel-tui-main.org +++ b/org/channel-tui-main.org @@ -852,7 +852,9 @@ Event handlers + daemon I/O + main loop. (cl-tty.input:read-event be :timeout 0) (cond ((eq type :resize) - (multiple-value-setq (w h) (cl-tty.backend:backend-size be)) + (multiple-value-setq (w h) + (or (ignore-errors (cl-tty.backend:backend-size be)) + (values 80 24))) (setf prev-fb (cl-tty.rendering:make-framebuffer w h) curr-fb (cl-tty.rendering:make-framebuffer w h)) (setf (getf *state* :dirty) (list t t t)))