mirror of
https://github.com/TrustTunnel/TrustTunnel.git
synced 2026-04-26 20:36:02 +00:00
Pull request 144: Disable use of setup_wizard in interactive mode without a TTY
Squashed commit of the following: commit 2511d66376f6237ac134452492ba9b059a027609 Author: Zhavoronkov Aleksei <a.zhavoronkov@adguard.com> Date: Wed Jan 28 15:10:44 2026 +0300 Disable use of setup_wizard in interactive mode without a TTY
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
use crate::user_interaction::{ask_for_agreement, ask_for_input, checked_overwrite};
|
||||
use std::fs;
|
||||
use std::io::IsTerminal;
|
||||
use std::sync::{Mutex, MutexGuard};
|
||||
use trusttunnel::settings::{Settings, TlsHostsSettings};
|
||||
|
||||
@@ -167,6 +168,13 @@ Required in non-interactive mode."#,
|
||||
_ => unreachable!(),
|
||||
};
|
||||
|
||||
if *MODE.lock().unwrap() == Mode::Interactive && !std::io::stdin().is_terminal() {
|
||||
eprintln!("Error: Interactive mode requires a terminal (TTY).");
|
||||
eprintln!("Please run setup_wizard from a terminal, or use non-interactive mode:");
|
||||
eprintln!(" {} --help", std::env::args().next().unwrap_or_default());
|
||||
std::process::exit(1);
|
||||
}
|
||||
|
||||
*PREDEFINED_PARAMS.lock().unwrap() = PredefinedParameters {
|
||||
listen_address: args.get_one::<String>(LISTEN_ADDRESS_PARAM_NAME).cloned(),
|
||||
credentials: args
|
||||
|
||||
Reference in New Issue
Block a user