Skip to content

Commit 51f8f1a

Browse files
authored
Drop usage of atty (#884)
1 parent 2554a8a commit 51f8f1a

File tree

3 files changed

+7
-25
lines changed

3 files changed

+7
-25
lines changed

Cargo.lock

Lines changed: 1 addition & 22 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ categories = ["command-line-utilities", "compression", "encoding"]
1515
description = "A command-line utility for easily compressing and decompressing files and directories."
1616

1717
[dependencies]
18-
atty = "0.2.14"
1918
brotli = "7.0.0"
2019
bstr = { version = "1.10.0", default-features = false, features = ["std"] }
2120
bytesize = "1.3.0"

src/utils/colors.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22
33
#![allow(dead_code)]
44

5-
use std::env;
5+
use std::{
6+
env,
7+
io::{self, IsTerminal},
8+
ops::Not,
9+
};
610

711
use once_cell::sync::Lazy;
812

913
static DISABLE_COLORED_TEXT: Lazy<bool> = Lazy::new(|| {
10-
env::var_os("NO_COLOR").is_some() || atty::isnt(atty::Stream::Stdout) || atty::isnt(atty::Stream::Stderr)
14+
io::stdout().is_terminal().not() || io::stderr().is_terminal().not() || env::var_os("NO_COLOR").is_some()
1115
});
1216

1317
macro_rules! color {

0 commit comments

Comments
 (0)