Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: replace atty with is-terminal #122

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ keywords = ["color", "string", "term", "ansi_term", "term-painter"]
no-color = []

[dependencies]
atty = "0.2"
is-terminal = "0.4"
lazy_static = "1"

[target.'cfg(windows)'.dependencies.winapi]
Expand Down
5 changes: 4 additions & 1 deletion src/control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@

use std::default::Default;
use std::env;
use std::io::stdout;
use std::sync::atomic::{AtomicBool, Ordering};

use is_terminal::IsTerminal;

/// Sets a flag to the console to use a virtual terminal environment.
///
/// This is primarily used for Windows 10 environments which will not correctly colorize
Expand Down Expand Up @@ -105,7 +108,7 @@ impl ShouldColorize {
pub fn from_env() -> Self {
ShouldColorize {
clicolor: ShouldColorize::normalize_env(env::var("CLICOLOR")).unwrap_or(true)
&& atty::is(atty::Stream::Stdout),
&& stdout().is_terminal(),
clicolor_force: ShouldColorize::resolve_clicolor_force(
env::var("NO_COLOR"),
env::var("CLICOLOR_FORCE"),
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
//!
#![warn(missing_docs)]

extern crate atty;
extern crate is_terminal;
#[macro_use]
extern crate lazy_static;
#[cfg(windows)]
Expand Down