Skip to content

Commit

Permalink
chore: update nix crate (#26422)
Browse files Browse the repository at this point in the history
Dedupes nix dependency, since `rustyline` depends on a newer version
that what we currently use
  • Loading branch information
crowlKats authored and bartlomieju committed Oct 25, 2024
1 parent fc09833 commit b21fe64
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 37 deletions.
39 changes: 8 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ quote = "1"
syn = { version = "2", features = ["full", "extra-traits"] }

# unix
nix = "=0.26.2"
nix = "=0.27.1"

# windows deps
junction = "=0.2.0"
Expand Down
2 changes: 1 addition & 1 deletion ext/fs/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ serde.workspace = true
thiserror.workspace = true

[target.'cfg(unix)'.dependencies]
nix.workspace = true
nix = { workspace = true, features = ["user"] }

[target.'cfg(windows)'.dependencies]
winapi = { workspace = true, features = ["winbase"] }
Expand Down
3 changes: 2 additions & 1 deletion runtime/ops/tty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,8 @@ fn op_set_raw(
let tty_mode_store = state.borrow::<TtyModeStore>().clone();
let previous_mode = tty_mode_store.get(rid);

let raw_fd = handle_or_fd;
// SAFETY: Nix crate requires value to implement the AsFd trait
let raw_fd = unsafe { std::os::fd::BorrowedFd::borrow_raw(handle_or_fd) };

if is_raw {
let mut raw = match previous_mode {
Expand Down
2 changes: 1 addition & 1 deletion tests/util/server/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ lazy-regex.workspace = true
libc.workspace = true
lsp-types.workspace = true
monch.workspace = true
nix.workspace = true
nix = { workspace = true, features = ["fs", "term", "signal"] }
once_cell.workspace = true
os_pipe.workspace = true
parking_lot.workspace = true
Expand Down
6 changes: 4 additions & 2 deletions tests/util/server/src/pty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,12 @@ fn setup_pty(fd: i32) {
use nix::sys::termios::tcsetattr;
use nix::sys::termios::SetArg;

let mut term = tcgetattr(fd).unwrap();
// SAFETY: Nix crate requires value to implement the AsFd trait
let as_fd = unsafe { std::os::fd::BorrowedFd::borrow_raw(fd) };
let mut term = tcgetattr(as_fd).unwrap();
// disable cooked mode
term.local_flags.remove(termios::LocalFlags::ICANON);
tcsetattr(fd, SetArg::TCSANOW, &term).unwrap();
tcsetattr(as_fd, SetArg::TCSANOW, &term).unwrap();

// turn on non-blocking mode so we get timeouts
let flags = fcntl(fd, FcntlArg::F_GETFL).unwrap();
Expand Down

0 comments on commit b21fe64

Please sign in to comment.