Skip to content

Commit

Permalink
Replace atty crate with std::io::IsTerminal
Browse files Browse the repository at this point in the history
  • Loading branch information
athre0z committed Jul 30, 2023
1 parent f8dbec3 commit 68298cb
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,5 @@ resolve-modules = ["regex"]

[dependencies]
termcolor = "1.0"
atty = "0.2"
backtrace = "0.3"
regex = { version = "1.4", optional = true }
4 changes: 2 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@

use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader, ErrorKind};
use std::io::{BufRead, BufReader, ErrorKind, IsTerminal as _};
use std::panic::PanicInfo;
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
Expand Down Expand Up @@ -114,7 +114,7 @@ pub fn install() {
/// If stderr is attached to a tty, this is a colorized stderr, else it's
/// a plain (colorless) stderr.
pub fn default_output_stream() -> Box<StandardStream> {
Box::new(StandardStream::stderr(if atty::is(atty::Stream::Stderr) {
Box::new(StandardStream::stderr(if std::io::stderr().is_terminal() {
ColorChoice::Always
} else {
ColorChoice::Never
Expand Down

0 comments on commit 68298cb

Please sign in to comment.