diff --git a/Cargo.lock b/Cargo.lock index 2396871..43c9925 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1203,7 +1203,7 @@ dependencies = [ [[package]] name = "ostiary" -version = "1.1.2" +version = "1.1.3" dependencies = [ "anyhow", "base64", diff --git a/Cargo.toml b/Cargo.toml index 8ddf249..7d08af6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "ostiary" -version = "1.1.2" +version = "1.1.3" edition = "2024" [dependencies] diff --git a/src/main.rs b/src/main.rs index cf8885e..b790a77 100644 --- a/src/main.rs +++ b/src/main.rs @@ -172,17 +172,15 @@ async fn run_exec( fn prompt_first_endpoint() -> Result<(String, String)> { use std::io::{BufRead, BufReader, Write}; - // Open /dev/tty directly so input works even when launched via `curl | bash` - // (where stdin is the pipe carrying the script, not the keyboard). - let tty = std::fs::OpenOptions::new() - .read(true) - .write(true) - .open("/dev/tty") + // Open /dev/tty read-only for keyboard input so the wizard works even when + // stdin is a pipe (e.g. `curl | bash`). Writing goes through stdout so we + // don't touch the terminal's write-side state before crossterm takes over. + let tty_in = std::fs::File::open("/dev/tty") .map_err(|e| anyhow::anyhow!( "Не удалось открыть терминал ({e}). Запустите ostiary напрямую." ))?; - let mut out = tty.try_clone()?; - let mut reader = BufReader::new(tty); + let mut reader = BufReader::new(tty_in); + let mut out = std::io::stdout(); writeln!(out)?; writeln!(out, " ╔══════════════════════════════════╗")?;