From a64a50db47fbf2f3b89cfbd6afafdcf70ae168d5 Mon Sep 17 00:00:00 2001 From: Fabian Boehm Date: Sun, 10 Mar 2024 20:47:26 +0100 Subject: [PATCH] reader: Use our isatty overload Removes an annoying use of unsafe --- src/reader.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/reader.rs b/src/reader.rs index 540cf589e..721a344fe 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -73,6 +73,7 @@ use crate::input_common::{CharEvent, CharInputStyle, ReadlineCmd}; use crate::io::IoChain; use crate::kill::{kill_add, kill_replace, kill_yank, kill_yank_rotate}; use crate::libc::MB_CUR_MAX; +use crate::nix::isatty; use crate::operation_context::{get_bg_context, OperationContext}; use crate::output::Outputter; use crate::pager::{PageRendering, Pager, SelectionMotion}; @@ -548,8 +549,7 @@ pub fn reader_read(parser: &Parser, fd: RawFd, io: &IoChain) -> c_int { // int inter = ((fd == STDIN_FILENO) && isatty(STDIN_FILENO)); if fd == STDIN_FILENO { let mut t: libc::termios = unsafe { std::mem::zeroed() }; - let a_tty = unsafe { libc::isatty(STDIN_FILENO) } != 0; - if a_tty { + if isatty(STDIN_FILENO) { interactive = true; } else if unsafe { libc::tcgetattr(STDIN_FILENO, &mut t) } == -1 && errno().0 == EIO { redirect_tty_output();