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