Skip to content

Commit fb1d960

Browse files
authored
Merge pull request #4249 from jcgruenhage/replace-atty
chore: replace atty with is-terminal
2 parents 789bfd6 + aaac3c4 commit fb1d960

3 files changed

Lines changed: 128 additions & 21 deletions

File tree

Cargo.lock

Lines changed: 121 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ unstable-doc = ["derive", "cargo", "wrap_help", "env", "unicode", "string", "uns
6767

6868
# Used in default
6969
std = [] # support for no_std in a backwards-compatible way
70-
color = ["dep:atty", "dep:termcolor"]
70+
color = ["dep:is-terminal", "dep:termcolor"]
7171
help = []
7272
usage = []
7373
error-context = []
@@ -96,7 +96,7 @@ clap_lex = { path = "./clap_lex", version = "0.3.0" }
9696
bitflags = "1.2"
9797
unicase = { version = "2.6", optional = true }
9898
strsim = { version = "0.10", optional = true }
99-
atty = { version = "0.2", optional = true }
99+
is-terminal = { version = "0.4", optional = true }
100100
termcolor = { version = "1.1.1", optional = true }
101101
terminal_size = { version = "0.2.1", optional = true }
102102
backtrace = { version = "0.3", optional = true }

src/output/fmt.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,10 +82,9 @@ impl std::fmt::Display for Colorizer {
8282

8383
#[cfg(feature = "color")]
8484
fn is_a_tty(stream: Stream) -> bool {
85-
let stream = match stream {
86-
Stream::Stdout => atty::Stream::Stdout,
87-
Stream::Stderr => atty::Stream::Stderr,
88-
};
89-
90-
atty::is(stream)
85+
use is_terminal::IsTerminal;
86+
match stream {
87+
Stream::Stdout => std::io::stdout().is_terminal(),
88+
Stream::Stderr => std::io::stderr().is_terminal(),
89+
}
9190
}

0 commit comments

Comments
 (0)