remove is_terminal function, same functionality exists in rust standard library

This commit is contained in:
2025-03-16 06:22:04 -04:00
parent 28f1f957a9
commit ddfcde4531
2 changed files with 0 additions and 20 deletions

View File

@@ -2,7 +2,6 @@ use std::ffi::{c_int, c_uint, c_ulong, c_ushort};
use std::io; use std::io;
unsafe extern "C" { unsafe extern "C" {
fn isatty(fd: c_int) -> c_int;
fn ioctl(fd: c_int, request: c_ulong, argp: *mut u8) -> 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 tcgetattr(fd: c_int, termios_p: *mut Termios) -> c_int;
fn tcsetattr(fd: c_int, optional_actions: c_int, termios: *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], 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 /// Enables ANSI support on Windows terminals
/// ///
/// ANSI is on by default on *nix machines but still exists on them for simpler usage /// ANSI is on by default on *nix machines but still exists on them for simpler usage

View File

@@ -36,19 +36,6 @@ struct ConsoleScreenBufferInfo {
dwMaximumWindowSizeY: u16, 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 /// Enables ANSI support on Windows terminals
/// ///
/// ANSI is on by default on *nix machines but still exists on them for simpler usage /// ANSI is on by default on *nix machines but still exists on them for simpler usage