Skip to content

Update dependencies to support more architectures #4351

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
257 changes: 128 additions & 129 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ lazy_static = { version = "1.4.0", default-features = false }
libc = { version = "0.2", default-features = false, features = ["std"] }
log = { version = "0.4.17", default-features = false }
miette = { version = "5.7.0", default-features = false, features = ["fancy"] }
nix = { version = "0.23.1", default-features = false }
nix = { version = "0.29.0", default-features = false, features = ["fs", "process", "signal", "term", "user"] }
notify-debouncer-full = { version = "0.3.1", default-features = false }
notify = { version = "6.1.1", default-features = false, features = ["macos_kqueue"] }
prost = { version = "0.11.9", default-features = false, features = ["std", "prost-derive"] }
Expand Down
17 changes: 9 additions & 8 deletions zellij-client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use log::info;
use std::env::current_exe;
use std::io::{self, Write};
use std::net::{IpAddr, Ipv4Addr};
use std::os::unix::io::AsFd;
use std::path::Path;
use std::process::Command;
use std::sync::{Arc, Mutex};
Expand Down Expand Up @@ -241,7 +242,7 @@ pub fn start_client(
let take_snapshot = "\u{1b}[?1049h";
let bracketed_paste = "\u{1b}[?2004h";
let enter_kitty_keyboard_mode = "\u{1b}[>1u";
os_input.unset_raw_mode(0).unwrap();
os_input.unset_raw_mode(io::stdin().as_fd()).unwrap();

if !is_a_reconnect {
// we don't do this for a reconnect because our controlling terminal already has the
Expand Down Expand Up @@ -269,7 +270,7 @@ pub fn start_client(
.theme_config(config_options.theme.as_ref())
.unwrap_or_else(|| os_input.load_palette().into());

let full_screen_ws = os_input.get_terminal_size_using_fd(0);
let full_screen_ws = os_input.get_terminal_size_using_fd(io::stdin().as_fd());
let client_attributes = ClientAttributes {
size: full_screen_ws,
style: Style {
Expand Down Expand Up @@ -358,7 +359,7 @@ pub fn start_client(

let mut command_is_executing = CommandIsExecuting::new();

os_input.set_raw_mode(0);
os_input.set_raw_mode(io::stdin().as_fd());
let _ = os_input
.get_stdout_writer()
.write(bracketed_paste.as_bytes())
Expand All @@ -379,7 +380,7 @@ pub fn start_client(
let send_client_instructions = send_client_instructions.clone();
let os_input = os_input.clone();
Box::new(move |info| {
if let Ok(()) = os_input.unset_raw_mode(0) {
if let Ok(()) = os_input.unset_raw_mode(io::stdin().as_fd()) {
handle_panic(info, &send_client_instructions);
}
})
Expand Down Expand Up @@ -436,7 +437,7 @@ pub fn start_client(
let os_api = os_input.clone();
move || {
os_api.send_to_server(ClientToServerMsg::TerminalResize(
os_api.get_terminal_size_using_fd(0),
os_api.get_terminal_size_using_fd(io::stdin().as_fd()),
));
}
}),
Expand Down Expand Up @@ -490,7 +491,7 @@ pub fn start_client(
.unwrap();

let handle_error = |backtrace: String| {
os_input.unset_raw_mode(0).unwrap();
os_input.unset_raw_mode(io::stdin().as_fd()).unwrap();
let goto_start_of_last_line = format!("\u{1b}[{};{}H", full_screen_ws.rows, 1);
let restore_snapshot = "\u{1b}[?1049l";
os_input.disable_mouse().non_fatal();
Expand Down Expand Up @@ -609,7 +610,7 @@ pub fn start_client(
},
ClientInstruction::QueryTerminalSize => {
os_input.send_to_server(ClientToServerMsg::TerminalResize(
os_input.get_terminal_size_using_fd(0),
os_input.get_terminal_size_using_fd(io::stdin().as_fd()),
));
},
ClientInstruction::WriteConfigToDisk { config } => {
Expand Down Expand Up @@ -667,7 +668,7 @@ pub fn start_client(

os_input.disable_mouse().non_fatal();
info!("{}", exit_msg);
os_input.unset_raw_mode(0).unwrap();
os_input.unset_raw_mode(io::stdin().as_fd()).unwrap();
let mut stdout = os_input.get_stdout_writer();
let exit_kitty_keyboard_mode = "\u{1b}[<1u";
if !explicitly_disable_kitty_keyboard_protocol {
Expand Down
24 changes: 12 additions & 12 deletions zellij-client/src/os_input_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use nix::sys::termios;
use signal_hook::{consts::signal::*, iterator::Signals};
use std::io::prelude::*;
use std::io::IsTerminal;
use std::os::unix::io::RawFd;
use std::os::unix::io::{AsRawFd, BorrowedFd};
use std::path::Path;
use std::sync::{Arc, Mutex};
use std::{io, thread, time};
Expand All @@ -30,7 +30,7 @@ const ENABLE_MOUSE_SUPPORT: &str =
const DISABLE_MOUSE_SUPPORT: &str =
"\u{1b}[?1006l\u{1b}[?1015l\u{1b}[?1003l\u{1b}[?1002l\u{1b}[?1000l";

fn into_raw_mode(pid: RawFd) {
fn into_raw_mode(pid: BorrowedFd) {
let mut tio = termios::tcgetattr(pid).expect("could not get terminal attribute");
termios::cfmakeraw(&mut tio);
match termios::tcsetattr(pid, termios::SetArg::TCSANOW, &tio) {
Expand All @@ -39,11 +39,11 @@ fn into_raw_mode(pid: RawFd) {
};
}

fn unset_raw_mode(pid: RawFd, orig_termios: termios::Termios) -> Result<(), nix::Error> {
fn unset_raw_mode(pid: BorrowedFd, orig_termios: termios::Termios) -> Result<(), nix::Error> {
termios::tcsetattr(pid, termios::SetArg::TCSANOW, &orig_termios)
}

pub(crate) fn get_terminal_size_using_fd(fd: RawFd) -> Size {
pub(crate) fn get_terminal_size_using_fd(fd: BorrowedFd) -> Size {
// TODO: do this with the nix ioctl
use libc::ioctl;
use libc::TIOCGWINSZ;
Expand All @@ -60,7 +60,7 @@ pub(crate) fn get_terminal_size_using_fd(fd: RawFd) -> Size {
// useless conversion.
#[allow(clippy::useless_conversion)]
unsafe {
ioctl(fd, TIOCGWINSZ.into(), &mut winsize)
ioctl(fd.as_raw_fd(), TIOCGWINSZ.into(), &mut winsize)
};

// fallback to default values when rows/cols == 0: https://github.com/zellij-org/zellij/issues/1551
Expand Down Expand Up @@ -98,13 +98,13 @@ impl std::fmt::Debug for ClientOsInputOutput {
/// Zellij client requires.
pub trait ClientOsApi: Send + Sync + std::fmt::Debug {
/// Returns the size of the terminal associated to file descriptor `fd`.
fn get_terminal_size_using_fd(&self, fd: RawFd) -> Size;
fn get_terminal_size_using_fd(&self, fd: BorrowedFd) -> Size;
/// Set the terminal associated to file descriptor `fd` to
/// [raw mode](https://en.wikipedia.org/wiki/Terminal_mode).
fn set_raw_mode(&mut self, fd: RawFd);
fn set_raw_mode(&mut self, fd: BorrowedFd);
/// Set the terminal associated to file descriptor `fd` to
/// [cooked mode](https://en.wikipedia.org/wiki/Terminal_mode).
fn unset_raw_mode(&self, fd: RawFd) -> Result<(), nix::Error>;
fn unset_raw_mode(&self, fd: BorrowedFd) -> Result<(), nix::Error>;
/// Returns the writer that allows writing to standard output.
fn get_stdout_writer(&self) -> Box<dyn io::Write>;
/// Returns a BufReader that allows to read from STDIN line by line, also locks STDIN
Expand Down Expand Up @@ -139,13 +139,13 @@ pub trait ClientOsApi: Send + Sync + std::fmt::Debug {
}

impl ClientOsApi for ClientOsInputOutput {
fn get_terminal_size_using_fd(&self, fd: RawFd) -> Size {
fn get_terminal_size_using_fd(&self, fd: BorrowedFd) -> Size {
get_terminal_size_using_fd(fd)
}
fn set_raw_mode(&mut self, fd: RawFd) {
fn set_raw_mode(&mut self, fd: BorrowedFd) {
into_raw_mode(fd);
}
fn unset_raw_mode(&self, fd: RawFd) -> Result<(), nix::Error> {
fn unset_raw_mode(&self, fd: BorrowedFd) -> Result<(), nix::Error> {
match &self.orig_termios {
Some(orig_termios) => {
let orig_termios = orig_termios.lock().unwrap();
Expand Down Expand Up @@ -328,7 +328,7 @@ impl Clone for Box<dyn ClientOsApi> {
}

pub fn get_client_os_input() -> Result<ClientOsInputOutput, nix::Error> {
let current_termios = termios::tcgetattr(0).ok();
let current_termios = termios::tcgetattr(io::stdin()).ok();
let orig_termios = current_termios.map(|termios| Arc::new(Mutex::new(termios)));
let reading_from_stdin = Arc::new(Mutex::new(None));
Ok(ClientOsInputOutput {
Expand Down
4 changes: 3 additions & 1 deletion zellij-client/src/web_client/server_listener.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ use crate::web_client::types::{ClientConnectionBus, ConnectionTable, SessionMana
use crate::web_client::utils::terminal_init_messages;

use std::{
io,
os::unix::io::AsFd,
path::PathBuf,
sync::{Arc, Mutex},
};
Expand Down Expand Up @@ -59,7 +61,7 @@ pub fn zellij_server_listener(

reload_config_from_disk(&mut config, &mut config_options, &config_file_path);

let full_screen_ws = os_input.get_terminal_size_using_fd(0);
let full_screen_ws = os_input.get_terminal_size_using_fd(io::stdin().as_fd());
let mut sent_init_messages = false;

let palette = config
Expand Down
6 changes: 3 additions & 3 deletions zellij-server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,11 @@ unicode-width = { workspace = true }
url = { workspace = true }
uuid = { workspace = true }
vte = { workspace = true }
wasmtime-wasi = { version = "29.0.1", default-features = false, features = ["preview1"] } # Keep in sync with wasmtime
wasmtime-wasi = { version = "30.0.2", default-features = false, features = ["preview1"] } # Keep in sync with wasmtime
zellij-utils = { workspace = true }

[dependencies.wasmtime]
version = "29.0.1" # Keep in sync with wasmtime-wasi
version = "30.0.2" # Keep in sync with wasmtime-wasi
default-features = false
features = [
'addr2line',
Expand All @@ -65,7 +65,7 @@ features = [
[dev-dependencies]
insta = "1.6.0"
tempfile = "3.2.0"
wasmtime = { version = "29.0.1", features = ["winch"] } # Keep in sync with the other wasmtime dep
wasmtime = { version = "30.0.2", features = ["winch"] } # Keep in sync with the other wasmtime dep

[features]
singlepass = ["wasmtime/winch"]
Expand Down
Loading