From baef3289fed1964ba615aeacfd9fc0f8d0c31d03 Mon Sep 17 00:00:00 2001 From: theS1LV3R Date: Sun, 12 Jul 2026 20:15:42 +0200 Subject: [PATCH] fix(service/admin): Prevent console from being spawned when no TTY is available --- src/service/admin/execute.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/service/admin/execute.rs b/src/service/admin/execute.rs index 9aeb80ce3..03c71981e 100644 --- a/src/service/admin/execute.rs +++ b/src/service/admin/execute.rs @@ -1,4 +1,6 @@ -use conduwuit::{Err, Result, debug, debug_info, error, info}; +use std::io::IsTerminal; + +use conduwuit::{Err, Result, debug, debug_info, error, info, warn}; use ruma::events::room::message::RoomMessageEventContent; use tokio::time::{Duration, sleep}; @@ -7,10 +9,16 @@ pub(super) const SIGNAL: &str = "SIGUSR2"; impl super::Service { - /// Possibly spawn the terminal console at startup if configured. + /// Possibly spawn the terminal console at startup if configured and a TTY + /// is available. pub(super) async fn console_auto_start(&self) { #[cfg(feature = "console")] if self.services.server.config.admin_console_automatic { + if !std::io::stdin().is_terminal() { + warn!("Console enabled without a tty available; Not enabling console"); + return; + } + // Allow more of the startup sequence to execute before spawning tokio::task::yield_now().await; self.console.start().await;