Skip to content

Commit

Permalink
fix: Replace atty with is_terminal
Browse files Browse the repository at this point in the history
  • Loading branch information
epage committed Nov 24, 2022
1 parent 2e88dc2 commit b1e1fbf
Show file tree
Hide file tree
Showing 3 changed files with 140 additions and 15 deletions.
145 changes: 134 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Cargo.toml
Expand Up @@ -39,7 +39,7 @@ pre-release-replacements = [
[features]
default = ["auto-color", "humantime", "regex"]
color = ["dep:termcolor"]
auto-color = ["dep:atty", "color"]
auto-color = ["dep:is-terminal", "color"]
humantime = ["dep:humantime"]
regex = ["dep:regex"]

Expand All @@ -48,7 +48,7 @@ log = { version = "0.4.8", features = ["std"] }
regex = { version = "1.0.3", optional = true, default-features=false, features=["std", "perf"] }
termcolor = { version = "1.1.1", optional = true }
humantime = { version = "2.0.0", optional = true }
atty = { version = "0.2.5", optional = true }
is-terminal = { version = "0.4.0", optional = true }

[[test]]
name = "regexp_filter"
Expand Down
6 changes: 4 additions & 2 deletions src/fmt/writer/atty.rs
Expand Up @@ -9,12 +9,14 @@ from being printed.

#[cfg(feature = "auto-color")]
mod imp {
use is_terminal::IsTerminal;

pub(in crate::fmt) fn is_stdout() -> bool {
atty::is(atty::Stream::Stdout)
std::io::stdout().is_terminal()
}

pub(in crate::fmt) fn is_stderr() -> bool {
atty::is(atty::Stream::Stderr)
std::io::stderr().is_terminal()
}
}

Expand Down

0 comments on commit b1e1fbf

Please sign in to comment.