From ddfcde453169a01cae8c144d3995e4eddda9bbd5 Mon Sep 17 00:00:00 2001 From: Xyverle Date: Sun, 16 Mar 2025 06:22:04 -0400 Subject: [PATCH] remove is_terminal function, same functionality exists in rust standard library --- src/unix.rs | 7 ------- src/windows.rs | 13 ------------- 2 files changed, 20 deletions(-) diff --git a/src/unix.rs b/src/unix.rs index 7730f24..95f9293 100644 --- a/src/unix.rs +++ b/src/unix.rs @@ -2,7 +2,6 @@ use std::ffi::{c_int, c_uint, c_ulong, c_ushort}; use std::io; unsafe extern "C" { - fn isatty(fd: c_int) -> c_int; fn ioctl(fd: c_int, request: c_ulong, argp: *mut u8) -> c_int; fn tcgetattr(fd: c_int, termios_p: *mut Termios) -> c_int; fn tcsetattr(fd: c_int, optional_actions: c_int, termios: *mut Termios) -> c_int; @@ -46,12 +45,6 @@ struct Termios { cc: [u8; NCCS], } -/// Checks if stdout is a terminal -#[must_use] -pub fn is_terminal() -> bool { - unsafe { isatty(1) != 0 } -} - /// Enables ANSI support on Windows terminals /// /// ANSI is on by default on *nix machines but still exists on them for simpler usage diff --git a/src/windows.rs b/src/windows.rs index 811fdeb..8e3b525 100644 --- a/src/windows.rs +++ b/src/windows.rs @@ -36,19 +36,6 @@ struct ConsoleScreenBufferInfo { dwMaximumWindowSizeY: u16, } -/// Checks if stdout is a terminal -#[must_use] -pub fn is_terminal() -> bool { - let handle = get_std_handle(STD_OUTPUT_HANDLE); - match handle { - Ok(handle) => { - let mut dwMode = 0; - unsafe { GetConsoleMode(handle, &mut dwMode) != 0 } - } - _ => false, - } -} - /// Enables ANSI support on Windows terminals /// /// ANSI is on by default on *nix machines but still exists on them for simpler usage