diff options
author | Martin Nordholts <enselic@gmail.com> | 2023-06-05 20:00:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-05 14:00:46 -0400 |
commit | 4fcb1b2202b97c5a21894672232700225223a138 (patch) | |
tree | 13bfdcbff6b242c9c0373fd66332b886e202a1aa /crates/cli | |
parent | 949092fd22689905fce358cdd1b2b676709feefe (diff) |
cli: replace atty with std::io::IsTerminal
The `atty` crate is unmaintained[1] and `std::io::IsTerminal` was
stabilized in Rust 1.70.
[1]: https://rustsec.org/advisories/RUSTSEC-2021-0145.html
PR #2526
Diffstat (limited to 'crates/cli')
-rw-r--r-- | crates/cli/Cargo.toml | 1 | ||||
-rw-r--r-- | crates/cli/src/lib.rs | 8 |
2 files changed, 5 insertions, 4 deletions
diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 27e7edd5..d9cc3444 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -14,7 +14,6 @@ license = "Unlicense OR MIT" edition = "2018" [dependencies] -atty = "0.2.11" bstr = "1.1.0" globset = { version = "0.4.10", path = "../globset" } lazy_static = "1.1.0" diff --git a/crates/cli/src/lib.rs b/crates/cli/src/lib.rs index e54893be..53b4d2c3 100644 --- a/crates/cli/src/lib.rs +++ b/crates/cli/src/lib.rs @@ -165,6 +165,8 @@ mod pattern; mod process; mod wtr; +use std::io::IsTerminal; + pub use crate::decompress::{ resolve_binary, DecompressionMatcher, DecompressionMatcherBuilder, DecompressionReader, DecompressionReaderBuilder, @@ -215,7 +217,7 @@ pub fn is_readable_stdin() -> bool { /// Returns true if and only if stdin is believed to be connected to a tty /// or a console. pub fn is_tty_stdin() -> bool { - atty::is(atty::Stream::Stdin) + std::io::stdin().is_terminal() } /// Returns true if and only if stdout is believed to be connected to a tty @@ -227,11 +229,11 @@ pub fn is_tty_stdin() -> bool { /// implementations of `ls` will often show one item per line when stdout is /// redirected, but will condensed output when printing to a tty. pub fn is_tty_stdout() -> bool { - atty::is(atty::Stream::Stdout) + std::io::stdout().is_terminal() } /// Returns true if and only if stderr is believed to be connected to a tty /// or a console. pub fn is_tty_stderr() -> bool { - atty::is(atty::Stream::Stderr) + std::io::stderr().is_terminal() } |