Fix first startup on macOS 3
This commit is contained in:
3
Cargo.lock
generated
3
Cargo.lock
generated
@@ -189,6 +189,7 @@ dependencies = [
|
||||
"crossterm_winapi",
|
||||
"derive_more",
|
||||
"document-features",
|
||||
"filedescriptor",
|
||||
"mio",
|
||||
"parking_lot",
|
||||
"rustix",
|
||||
@@ -1203,7 +1204,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "ostiary"
|
||||
version = "1.1.4"
|
||||
version = "1.1.5"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
[package]
|
||||
name = "ostiary"
|
||||
version = "1.1.4"
|
||||
version = "1.1.5"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
crossterm = "0.29"
|
||||
crossterm = { version = "0.29", features = ["use-dev-tty"] }
|
||||
ratatui = "0.30"
|
||||
tokio = { version = "1", features = ["full"] }
|
||||
reqwest = { version = "0.12", features = ["json", "stream", "rustls-tls"], default-features = false }
|
||||
|
||||
14
src/main.rs
14
src/main.rs
@@ -12,8 +12,6 @@ mod updater;
|
||||
|
||||
use std::io;
|
||||
use anyhow::Result;
|
||||
#[cfg(unix)]
|
||||
use libc;
|
||||
use crossterm::{
|
||||
event::{DisableMouseCapture, EnableMouseCapture},
|
||||
execute,
|
||||
@@ -31,18 +29,6 @@ async fn main() -> Result<()> {
|
||||
config::Config::create_with_endpoint(&url, &name)?
|
||||
};
|
||||
|
||||
// Before initializing the TUI, ensure our process group is the terminal's
|
||||
// foreground group. When launched from a non-interactive install script on
|
||||
// macOS, the parent shell may not have granted terminal ownership, causing
|
||||
// crossterm's kqueue-based input reader to fail silently.
|
||||
#[cfg(unix)]
|
||||
{
|
||||
use std::os::unix::io::AsRawFd;
|
||||
if let Ok(tty) = std::fs::File::open("/dev/tty") {
|
||||
unsafe { libc::tcsetpgrp(tty.as_raw_fd(), libc::getpgrp()); }
|
||||
}
|
||||
}
|
||||
|
||||
enable_raw_mode()?;
|
||||
let mut stdout = io::stdout();
|
||||
execute!(stdout, EnterAlternateScreen, EnableMouseCapture)?;
|
||||
|
||||
Reference in New Issue
Block a user