summaryrefslogtreecommitdiff
path: root/tests/util/server/src/pty.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/util/server/src/pty.rs')
-rw-r--r--tests/util/server/src/pty.rs24
1 files changed, 16 insertions, 8 deletions
diff --git a/tests/util/server/src/pty.rs b/tests/util/server/src/pty.rs
index 5d8049fee..07659262c 100644
--- a/tests/util/server/src/pty.rs
+++ b/tests/util/server/src/pty.rs
@@ -61,7 +61,10 @@ impl Pty {
if is_windows && *IS_CI {
// the pty tests don't really start up on the windows CI for some reason
// so ignore them for now
- eprintln!("Ignoring windows CI.");
+ #[allow(clippy::print_stderr)]
+ {
+ eprintln!("Ignoring windows CI.");
+ }
false
} else {
true
@@ -250,11 +253,14 @@ impl Pty {
}
let text = self.next_text();
- eprintln!(
- "------ Start Full Text ------\n{:?}\n------- End Full Text -------",
- String::from_utf8_lossy(&self.read_bytes)
- );
- eprintln!("Next text: {:?}", text);
+ #[allow(clippy::print_stderr)]
+ {
+ eprintln!(
+ "------ Start Full Text ------\n{:?}\n------- End Full Text -------",
+ String::from_utf8_lossy(&self.read_bytes)
+ );
+ eprintln!("Next text: {:?}", text);
+ }
false
}
@@ -297,10 +303,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();