From acac4afb351614ce5491d545ae3558048f5117b3 Mon Sep 17 00:00:00 2001 From: Ole Wieners Date: Fri, 8 Sep 2023 12:09:37 +0200 Subject: [PATCH] Replace `atty` dependency with `std::io::IsTerminal` --- backend/Cargo.lock | 21 --------------------- backend/Cargo.toml | 1 - backend/src/args.rs | 6 +++--- 3 files changed, 3 insertions(+), 25 deletions(-) diff --git a/backend/Cargo.lock b/backend/Cargo.lock index 3859faa5e..4b030c52a 100644 --- a/backend/Cargo.lock +++ b/backend/Cargo.lock @@ -148,17 +148,6 @@ dependencies = [ "syn 2.0.15", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi 0.1.19", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -1028,15 +1017,6 @@ version = "0.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" -[[package]] -name = "hermit-abi" -version = "0.1.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.2.6" @@ -2553,7 +2533,6 @@ name = "tobira" version = "2.1.0" dependencies = [ "anyhow", - "atty", "base64", "bincode", "bstr", diff --git a/backend/Cargo.toml b/backend/Cargo.toml index 8603ad767..f91dd6090 100644 --- a/backend/Cargo.toml +++ b/backend/Cargo.toml @@ -18,7 +18,6 @@ embed-in-debug = ["reinda/debug-is-prod"] [dependencies] anyhow = { version = "1.0.71", features = ["backtrace"] } -atty = "0.2.14" base64 = "0.21.0" bincode = "1.3.3" bstr = "1.4.0" diff --git a/backend/src/args.rs b/backend/src/args.rs index ad1c534a6..2de7b05d1 100644 --- a/backend/src/args.rs +++ b/backend/src/args.rs @@ -1,6 +1,6 @@ //! This module defines the command line arguments Tobira accepts. -use std::path::PathBuf; +use std::{path::PathBuf, io::IsTerminal}; use termcolor::ColorChoice; @@ -127,10 +127,10 @@ fn parse_color_choice(s: &str) -> Result { impl Args { pub(crate) fn stdout_color(&self) -> ColorChoice { - if atty::is(atty::Stream::Stdout) { self.color } else { ColorChoice::Never } + if std::io::stdout().is_terminal() { self.color } else { ColorChoice::Never } } pub(crate) fn stderr_color(&self) -> ColorChoice { - if atty::is(atty::Stream::Stderr) { self.color } else { ColorChoice::Never } + if std::io::stderr().is_terminal() { self.color } else { ColorChoice::Never } } }