From 3724e9d75ffa9a4c6fa7e2e8f712c05dff88e435 Mon Sep 17 00:00:00 2001 From: Brian Caswell Date: Thu, 6 Feb 2025 12:34:03 -0500 Subject: [PATCH] remove the dependency atty (#614) --- Cargo.lock | 45 +------------------------------------------- Cargo.toml | 3 +-- src/upload/status.rs | 4 +++- 3 files changed, 5 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9251252..57c06f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -80,17 +80,6 @@ dependencies = [ "syn", ] -[[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.2.0" @@ -102,7 +91,6 @@ name = "avml" version = "0.14.0" dependencies = [ "async-channel 2.3.1", - "atty", "azure_core", "azure_storage_blobs", "byteorder", @@ -731,15 +719,6 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" -[[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.3.9" @@ -1161,7 +1140,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ - "hermit-abi 0.3.9", + "hermit-abi", "libc", "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys", @@ -2192,28 +2171,6 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - [[package]] name = "windows-registry" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index ee57d6d..7ae2eff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ rust-version = "1.70.0" default = ["put", "blobstore", "native-tls"] put = ["dep:reqwest", "reqwest?/stream", "dep:url", "dep:tokio", "dep:tokio-util"] blobstore = ["dep:url", "dep:azure_core", "dep:azure_storage_blobs", "dep:tokio", "dep:tokio-util", "dep:async-channel"] -status = ["dep:atty", "dep:indicatif"] +status = ["dep:indicatif"] native-tls = ["dep:native-tls"] [dependencies] @@ -31,7 +31,6 @@ thiserror = "2.0" libc = "0.2" async-channel = {version="2.3", optional=true} -atty = {version="0.2", optional=true} azure_core = {version="0.21", optional=true} azure_storage_blobs = {version="0.21", optional=true} indicatif = {version="0.17", optional=true} diff --git a/src/upload/status.rs b/src/upload/status.rs index f89b9d0..feef2a8 100644 --- a/src/upload/status.rs +++ b/src/upload/status.rs @@ -3,6 +3,8 @@ #[cfg(all(feature = "status", any(feature = "blobstore", feature = "put")))] use indicatif::{ProgressBar, ProgressFinish, ProgressStyle}; +#[cfg(all(feature = "status", any(feature = "blobstore", feature = "put")))] +use std::io::{stdin, IsTerminal}; #[cfg(all(feature = "status", any(feature = "blobstore", feature = "put")))] #[derive(Clone)] @@ -15,7 +17,7 @@ pub struct Status { impl Status { pub fn new(total: Option) -> Self { let size = total.unwrap_or(0); - let bar = if atty::is(atty::Stream::Stdin) { + let bar = if stdin().is_terminal() { Some( ProgressBar::new(size) .with_style(