From f10df75c8a5f1b5e5f90689c3a8ceb6758366e05 Mon Sep 17 00:00:00 2001 From: akbash Date: Sun, 20 Sep 2026 18:12:12 +0300 Subject: fix: reject terminal-less attach before starting a session (#4395) refs #4393 Co-authored-by: akbash-bot <300245827+akbash-bot@users.noreply.github.com> Co-authored-by: JJ Liebig --- src/server/autodetect.rs | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/server') diff --git a/src/server/autodetect.rs b/src/server/autodetect.rs index e6fdaaa4..afd8edfd 100644 --- a/src/server/autodetect.rs +++ b/src/server/autodetect.rs @@ -293,6 +293,14 @@ pub fn wait_for_server_socket(socket_path: &Path, timeout: Duration) -> io::Resu /// 2. If no server → spawn server daemon → wait for socket readiness /// 3. Run the thin client (which connects to the server) pub fn auto_detect_launch(saved_federation: bool) -> io::Result<()> { + // The client requires terminal geometry before it can attach. Reject an + // unusable terminal before socket lookup creates directories or starts a daemon. + crate::platform::terminal_grid_size().map_err(|err| { + io::Error::new( + err.kind(), + format!("cannot attach without a usable terminal: {err}; run inside a terminal"), + ) + })?; let socket_path = client_socket_path(); info!(path = %socket_path.display(), "auto-detect launch starting"); -- cgit v1.2.3