diff options
| author | Laurenz <laurmaedje@gmail.com> | 2023-06-09 14:46:35 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2023-06-09 14:46:35 +0200 |
| commit | 58ca0e8db5f20848927e0dcb629fc478919081b6 (patch) | |
| tree | b1dd713c8dcb3be907ddb0f02a867da792f24c74 /cli/src/main.rs | |
| parent | 635ef03273792a07e6f227a17b30d3f93c6a1216 (diff) | |
Replace atty with std
Diffstat (limited to 'cli/src/main.rs')
| -rw-r--r-- | cli/src/main.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/cli/src/main.rs b/cli/src/main.rs index 17817655..d4fdfcf0 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -5,11 +5,10 @@ use std::cell::{Cell, RefCell, RefMut}; use std::collections::HashMap; use std::fs::{self, File}; use std::hash::Hash; -use std::io::{self, Write}; +use std::io::{self, IsTerminal, Write}; use std::path::{Path, PathBuf}; use std::process::ExitCode; -use atty::Stream; use chrono::Datelike; use clap::Parser; use codespan_reporting::diagnostic::{Diagnostic, Label}; @@ -368,7 +367,7 @@ fn status(command: &CompileSettings, status: Status) -> io::Result<()> { let color = status.color(); let mut w = color_stream(); - if atty::is(Stream::Stderr) { + if std::io::stderr().is_terminal() { // Clear the terminal. write!(w, "{esc}c{esc}[1;1H")?; } @@ -392,7 +391,7 @@ fn status(command: &CompileSettings, status: Status) -> io::Result<()> { /// Get stderr with color support if desirable. fn color_stream() -> termcolor::StandardStream { - termcolor::StandardStream::stderr(if atty::is(Stream::Stderr) { + termcolor::StandardStream::stderr(if std::io::stderr().is_terminal() { ColorChoice::Auto } else { ColorChoice::Never |
