Replace atty with std::io::IsTerminal (#380)

This commit is contained in:
Niklas Mohrin 2024-10-02 22:32:17 +02:00 committed by GitHub
commit ec2daa495c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 26 deletions

View file

@ -30,10 +30,13 @@ compile_error!(
"exactly one of the features \"native-roots\", \"webpki-roots\" or \"native-tls\" must be enabled"
);
use std::{env, process};
use std::{
env,
io::{self, IsTerminal},
process,
};
use app_dirs::AppInfo;
use atty::Stream;
use clap::Parser;
mod cache;
@ -258,7 +261,7 @@ fn main() {
// * NO_COLOR env var isn't set: https://no-color.org/
// * The output stream is stdout (not being piped)
ColorOptions::Auto => {
ansi_support && env::var_os("NO_COLOR").is_none() && atty::is(Stream::Stdout)
ansi_support && env::var_os("NO_COLOR").is_none() && io::stdout().is_terminal()
}
// Disable styling
ColorOptions::Never => false,