From ddea797c0a9a4c58458a8b32318b06b8f182963d Mon Sep 17 00:00:00 2001 From: ardocrat Date: Thu, 8 Jan 2026 22:40:42 +0300 Subject: [PATCH] Disable TUI on binary launch (#3818) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * adding --no-tui * revert next line * english comments * bin: more detailed no-tui flag description --------- Co-authored-by: Jörg Wieschebrock --- src/bin/grin.rs | 21 ++++++++++++++++++++- src/bin/grin.yml | 4 ++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/bin/grin.rs b/src/bin/grin.rs index 2d32be29..8d847fec 100644 --- a/src/bin/grin.rs +++ b/src/bin/grin.rs @@ -87,7 +87,7 @@ fn real_main() -> i32 { let args = App::from_yaml(yml) .version(built_info::PKG_VERSION) .get_matches(); - let node_config; + let mut node_config; let chain_type = if args.is_present("testnet") { global::ChainTypes::Testnet @@ -136,6 +136,25 @@ fn real_main() -> i32 { let mut logging_config = config.members.as_ref().unwrap().logging.clone().unwrap(); logging_config.tui_running = config.members.as_ref().unwrap().server.run_tui; + // Handle global --no-tui flag and GRIN_NO_TUI environment variable + let no_tui = args.is_present("no-tui") + || std::env::var("GRIN_NO_TUI") + .map(|v| v == "1" || v.eq_ignore_ascii_case("true")) + .unwrap_or(false); + + if no_tui { + // Deactivate logger TUI + logging_config.tui_running = Some(false); + + // Deactivate Server TUI in node config, so + // cmd::server_command(...) will not use it + if let Some(gc) = node_config.as_mut() { + if let Some(members) = gc.members.as_mut() { + members.server.run_tui = Some(false); + } + } + } + let api_chan: &'static mut (oneshot::Sender<()>, oneshot::Receiver<()>) = Box::leak(Box::new(oneshot::channel::<()>())); diff --git a/src/bin/grin.yml b/src/bin/grin.yml index 20a49374..1390e1c6 100644 --- a/src/bin/grin.yml +++ b/src/bin/grin.yml @@ -11,6 +11,10 @@ args: help: Run grin as a local-only network. Doesn't block peer connections but will not connect to any peer or seed long: usernet takes_value: false + - no-tui: + help: Disable the interactive TUI ignoring configuration file value (force log-only mode) + long: no-tui + takes_value: false subcommands: - clean: about: Clean Grin chain data