diff options
author | Christian Duerr <contact@christianduerr.com> | 2023-10-08 05:29:57 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-08 07:29:57 +0400 |
commit | 59c63d373804fe9d00d92d2dd47174d4e1637333 (patch) | |
tree | 4e80165d62fd632f0a5b5c285845fc9f97ee1e0b /alacritty_terminal | |
parent | c2f8abecfbaf6b6388e7746b733b7f22cbb7a750 (diff) | |
download | alacritty-59c63d373804fe9d00d92d2dd47174d4e1637333.tar.gz alacritty-59c63d373804fe9d00d92d2dd47174d4e1637333.zip |
Update dependencies
This patch applies all breaking and non-breaking dependency updates
and bumps MSRV to 1.70.0.
Diffstat (limited to 'alacritty_terminal')
-rw-r--r-- | alacritty_terminal/Cargo.toml | 12 | ||||
-rw-r--r-- | alacritty_terminal/src/term/mod.rs | 6 | ||||
-rw-r--r-- | alacritty_terminal/src/tty/unix.rs | 27 |
3 files changed, 25 insertions, 20 deletions
diff --git a/alacritty_terminal/Cargo.toml b/alacritty_terminal/Cargo.toml index 7498afab..e6712de3 100644 --- a/alacritty_terminal/Cargo.toml +++ b/alacritty_terminal/Cargo.toml @@ -7,7 +7,7 @@ description = "Library for writing terminal emulators" readme = "../README.md" homepage = "https://github.com/alacritty/alacritty" edition = "2021" -rust-version = "1.65.0" +rust-version = "1.70.0" [dependencies.alacritty_config_derive] path = "../alacritty_config_derive" @@ -18,7 +18,7 @@ path = "../alacritty_config" version = "0.1.2-dev" [dependencies] -base64 = "0.13.0" +base64 = "0.21.3" bitflags = { version = "2.2.1", features = ["serde"] } home = "0.5.5" libc = "0.2" @@ -27,18 +27,18 @@ parking_lot = "0.12.0" polling = "3.0.0" regex-automata = "0.3.6" serde = { version = "1", features = ["derive", "rc"] } -serde_yaml = "0.8" -toml = "0.7.1" +serde_yaml = "0.9.25" +toml = "0.8.2" unicode-width = "0.1" vte = { version = "0.12.0", default-features = false, features = ["ansi", "serde"] } [target.'cfg(unix)'.dependencies] -nix = { version = "0.26.2", default-features = false, features = ["term"] } +nix = { version = "0.27.1", default-features = false, features = ["term"] } signal-hook = "0.3.10" [target.'cfg(windows)'.dependencies] piper = "0.2.1" -miow = "0.3.0" +miow = "0.6.0" windows-sys = { version = "0.48.0", features = [ "Win32_System_Console", "Win32_Foundation", diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index 2e66b402..fd537122 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -4,6 +4,8 @@ use std::ops::{Index, IndexMut, Range}; use std::sync::Arc; use std::{cmp, mem, ptr, slice, str}; +use base64::engine::general_purpose::STANDARD as Base64; +use base64::Engine; use bitflags::bitflags; use log::{debug, trace}; use unicode_width::UnicodeWidthChar; @@ -1556,7 +1558,7 @@ impl<T: EventListener> Handler for Term<T> { _ => return, }; - if let Ok(bytes) = base64::decode(base64) { + if let Ok(bytes) = Base64.decode(base64) { if let Ok(text) = String::from_utf8(bytes) { self.event_proxy.send_event(Event::ClipboardStore(clipboard_type, text)); } @@ -1582,7 +1584,7 @@ impl<T: EventListener> Handler for Term<T> { self.event_proxy.send_event(Event::ClipboardLoad( clipboard_type, Arc::new(move |text| { - let base64 = base64::encode(text); + let base64 = Base64.encode(text); format!("\x1b]52;{};{}{}", clipboard as char, base64, terminator) }), )); diff --git a/alacritty_terminal/src/tty/unix.rs b/alacritty_terminal/src/tty/unix.rs index 4523666e..46073cc9 100644 --- a/alacritty_terminal/src/tty/unix.rs +++ b/alacritty_terminal/src/tty/unix.rs @@ -4,7 +4,8 @@ use std::ffi::CStr; use std::fs::File; use std::io::{Error, ErrorKind, Read, Result}; use std::mem::MaybeUninit; -use std::os::unix::io::{AsRawFd, FromRawFd, RawFd}; +use std::os::fd::OwnedFd; +use std::os::unix::io::{AsRawFd, FromRawFd}; use std::os::unix::net::UnixStream; use std::os::unix::process::CommandExt; use std::process::{Child, Command, Stdio}; @@ -38,7 +39,7 @@ macro_rules! die { } /// Get raw fds for master/slave ends of a new PTY. -fn make_pty(size: winsize) -> Result<(RawFd, RawFd)> { +fn make_pty(size: winsize) -> Result<(OwnedFd, OwnedFd)> { let mut window_size = size; window_size.ws_xpixel = 0; window_size.ws_ypixel = 0; @@ -194,12 +195,14 @@ fn default_shell_command(shell: &str, user: &str) -> Command { /// Create a new TTY and return a handle to interact with it. pub fn new(config: &PtyConfig, window_size: WindowSize, window_id: u64) -> Result<Pty> { let (master, slave) = make_pty(window_size.to_winsize())?; + let master_fd = master.as_raw_fd(); + let slave_fd = slave.as_raw_fd(); #[cfg(any(target_os = "linux", target_os = "macos"))] - if let Ok(mut termios) = termios::tcgetattr(master) { + 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); + let _ = termios::tcsetattr(&master, SetArg::TCSANOW, &termios); } let user = ShellUser::from_env()?; @@ -216,9 +219,9 @@ pub fn new(config: &PtyConfig, window_size: WindowSize, window_id: u64) -> Resul // Ownership of fd is transferred to the Stdio structs and will be closed by them at the end of // this scope. (It is not an issue that the fd is closed three times since File::drop ignores // error on libc::close.). - builder.stdin(unsafe { Stdio::from_raw_fd(slave) }); - builder.stderr(unsafe { Stdio::from_raw_fd(slave) }); - builder.stdout(unsafe { Stdio::from_raw_fd(slave) }); + builder.stdin(unsafe { Stdio::from_raw_fd(slave_fd) }); + builder.stderr(unsafe { Stdio::from_raw_fd(slave_fd) }); + builder.stdout(unsafe { Stdio::from_raw_fd(slave_fd) }); // Setup shell environment. let window_id = window_id.to_string(); @@ -237,11 +240,11 @@ pub fn new(config: &PtyConfig, window_size: WindowSize, window_id: u64) -> Resul return Err(Error::new(ErrorKind::Other, "Failed to set session id")); } - set_controlling_terminal(slave); + set_controlling_terminal(slave_fd); // No longer need slave/master fds. - libc::close(slave); - libc::close(master); + libc::close(slave_fd); + libc::close(master_fd); libc::signal(libc::SIGCHLD, libc::SIG_DFL); libc::signal(libc::SIGHUP, libc::SIG_DFL); @@ -274,10 +277,10 @@ pub fn new(config: &PtyConfig, window_size: WindowSize, window_id: u64) -> Resul unsafe { // Maybe this should be done outside of this function so nonblocking // isn't forced upon consumers. Although maybe it should be? - set_nonblocking(master); + set_nonblocking(master_fd); } - let mut pty = Pty { child, file: unsafe { File::from_raw_fd(master) }, signals }; + let mut pty = Pty { child, file: unsafe { File::from_raw_fd(master_fd) }, signals }; pty.on_resize(window_size); Ok(pty) }, |