Skip to content
This repository has been archived by the owner on Jul 3, 2023. It is now read-only.

chore: replace atty with is-terminal #21

Merged
merged 1 commit into from
Nov 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions crates/concolor/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ std = []
core = ["std", "bitflags"]
# Cross-crate API control is not guaranteed until our 1.0 release
api_unstable = ["core"]
interactive = ["core", "atty"]
interactive = ["core", "dep:is-terminal"]
clicolor = ["core", "concolor-query"]
no_color = ["core", "concolor-query"]
term = ["core", "concolor-query"]
Expand All @@ -34,4 +34,4 @@ features = ["auto", "api_unstable"]
[dependencies]
concolor-query = { version = "^0.1.0", path = "../query", optional = true }
bitflags = { version = "1", optional = true }
atty = { version = "0.2.14", optional = true }
is-terminal = { version = "0.4", optional = true }
6 changes: 4 additions & 2 deletions crates/concolor/src/color/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,12 @@ fn init() -> usize {

#[cfg(feature = "interactive")]
{
if atty::is(atty::Stream::Stdout) {
use is_terminal::IsTerminal;
use std::io::{stderr, stdout};
if stdout().is_terminal() {
flags |= InternalFlags::TTY_STDOUT;
}
if atty::is(atty::Stream::Stderr) {
if stderr().is_terminal() {
flags |= InternalFlags::TTY_STDERR;
}
}
Expand Down