summaryrefslogtreecommitdiff
path: root/tests/util
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2024-10-19 14:59:39 -0700
committerGitHub <noreply@github.com>2024-10-19 21:59:39 +0000
commit473e3069de4bf5877a6f1140aa0462e05f745536 (patch)
tree7d26a38a78f3f8552f83c0112196004531b46e44 /tests/util
parent85709c70abb538cf22df73261bc37453e7cb07a7 (diff)
chore: update nix crate (#26422)
Dedupes nix dependency, since `rustyline` depends on a newer version that what we currently use
Diffstat (limited to 'tests/util')
-rw-r--r--tests/util/server/Cargo.toml2
-rw-r--r--tests/util/server/src/pty.rs6
2 files changed, 5 insertions, 3 deletions
diff --git a/tests/util/server/Cargo.toml b/tests/util/server/Cargo.toml
index a321501b8..aee7ef0be 100644
--- a/tests/util/server/Cargo.toml
+++ b/tests/util/server/Cargo.toml
@@ -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
diff --git a/tests/util/server/src/pty.rs b/tests/util/server/src/pty.rs
index 5d8049fee..8d42fed78 100644
--- a/tests/util/server/src/pty.rs
+++ b/tests/util/server/src/pty.rs
@@ -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();