aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock25
-rw-r--r--alacritty_terminal/Cargo.toml2
-rw-r--r--alacritty_terminal/src/tty/unix.rs29
3 files changed, 29 insertions, 27 deletions
diff --git a/Cargo.lock b/Cargo.lock
index ca4fefa3..43d6379b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -100,11 +100,11 @@ dependencies = [
"libc",
"log",
"miow",
- "nix 0.27.1",
"parking_lot",
"piper",
"polling",
"regex-automata",
+ "rustix-openpty",
"serde",
"serde_json",
"serde_yaml",
@@ -1315,17 +1315,6 @@ dependencies = [
]
[[package]]
-name = "nix"
-version = "0.27.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053"
-dependencies = [
- "bitflags 2.4.0",
- "cfg-if",
- "libc",
-]
-
-[[package]]
name = "nom"
version = "7.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -1658,12 +1647,24 @@ checksum = "f25469e9ae0f3d0047ca8b93fc56843f38e6774f0914a107ff8b41be8be8e0b7"
dependencies = [
"bitflags 2.4.0",
"errno",
+ "itoa",
"libc",
"linux-raw-sys",
"windows-sys 0.48.0",
]
[[package]]
+name = "rustix-openpty"
+version = "0.1.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a25c3aad9fc1424eb82c88087789a7d938e1829724f3e4043163baf0d13cfc12"
+dependencies = [
+ "errno",
+ "libc",
+ "rustix",
+]
+
+[[package]]
name = "ryu"
version = "1.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/alacritty_terminal/Cargo.toml b/alacritty_terminal/Cargo.toml
index e6712de3..a0bdac49 100644
--- a/alacritty_terminal/Cargo.toml
+++ b/alacritty_terminal/Cargo.toml
@@ -33,7 +33,7 @@ unicode-width = "0.1"
vte = { version = "0.12.0", default-features = false, features = ["ansi", "serde"] }
[target.'cfg(unix)'.dependencies]
-nix = { version = "0.27.1", default-features = false, features = ["term"] }
+rustix-openpty = "0.1.1"
signal-hook = "0.3.10"
[target.'cfg(windows)'.dependencies]
diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs
index 3fecaef8..6b543437 100644
--- a/alacritty_terminal/src/tty/unix.rs
+++ b/alacritty_terminal/src/tty/unix.rs
@@ -12,12 +12,13 @@ use std::process::{Child, Command, Stdio};
use std::sync::Arc;
use std::{env, ptr};
-use libc::{self, c_int, winsize, TIOCSCTTY};
+use libc::{self, c_int, TIOCSCTTY};
use log::error;
-use nix::pty::openpty;
-#[cfg(any(target_os = "linux", target_os = "macos"))]
-use nix::sys::termios::{self, InputFlags, SetArg};
use polling::{Event, PollMode, Poller};
+use rustix_openpty::openpty;
+use rustix_openpty::rustix::termios::Winsize;
+#[cfg(any(target_os = "linux", target_os = "macos"))]
+use rustix_openpty::rustix::termios::{self, InputModes, OptionalActions};
use signal_hook::consts as sigconsts;
use signal_hook::low_level::pipe as signal_pipe;
@@ -39,14 +40,14 @@ macro_rules! die {
}
/// Get raw fds for master/slave ends of a new PTY.
-fn make_pty(size: winsize) -> Result<(OwnedFd, OwnedFd)> {
+fn make_pty(size: Winsize) -> Result<(OwnedFd, OwnedFd)> {
let mut window_size = size;
window_size.ws_xpixel = 0;
window_size.ws_ypixel = 0;
- let ends = openpty(Some(&window_size), None)?;
+ let ends = openpty(None, Some(&window_size))?;
- Ok((ends.master, ends.slave))
+ Ok((ends.controller, ends.user))
}
/// Really only needed on BSD, but should be fine elsewhere.
@@ -201,8 +202,8 @@ pub fn new(config: &PtyConfig, window_size: WindowSize, window_id: u64) -> Resul
#[cfg(any(target_os = "linux", target_os = "macos"))]
if let Ok(mut termios) = termios::tcgetattr(&master) {
// Set character encoding to UTF-8.
- termios.input_flags.set(InputFlags::IUTF8, true);
- let _ = termios::tcsetattr(&master, SetArg::TCSANOW, &termios);
+ termios.input_modes.set(InputModes::IUTF8, true);
+ let _ = termios::tcsetattr(&master, OptionalActions::Now, &termios);
}
let user = ShellUser::from_env()?;
@@ -404,20 +405,20 @@ impl OnResize for Pty {
}
}
-/// Types that can produce a `libc::winsize`.
+/// Types that can produce a `Winsize`.
pub trait ToWinsize {
- /// Get a `libc::winsize`.
- fn to_winsize(self) -> winsize;
+ /// Get a `Winsize`.
+ fn to_winsize(self) -> Winsize;
}
impl ToWinsize for WindowSize {
- fn to_winsize(self) -> winsize {
+ fn to_winsize(self) -> Winsize {
let ws_row = self.num_lines as libc::c_ushort;
let ws_col = self.num_cols as libc::c_ushort;
let ws_xpixel = ws_col * self.cell_width as libc::c_ushort;
let ws_ypixel = ws_row * self.cell_height as libc::c_ushort;
- winsize { ws_row, ws_col, ws_xpixel, ws_ypixel }
+ Winsize { ws_row, ws_col, ws_xpixel, ws_ypixel }
}
}