aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorakbash <akbash@herdr.dev>2026-09-20 18:12:12 +0300
committerGitHub <noreply@github.com>2026-09-20 17:12:12 +0200
commitf10df75c8a5f1b5e5f90689c3a8ceb6758366e05 (patch)
tree3fa0fa2a9f48cf1cf1f0820cfab94abda63b8549 /src
parent65927cef1c735169ba07677311ec9d6d7435c9f3 (diff)
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 <jonathan.liebig@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/server/autodetect.rs8
1 files changed, 8 insertions, 0 deletions
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");