From ef2bf6e5121bcce7d1e67771db5d360de2b62af1 Mon Sep 17 00:00:00 2001 From: tottoto Date: Sun, 2 Jul 2023 01:13:07 +0900 Subject: [PATCH] Replace atty with std::io::IsTerminal (#973) Co-authored-by: Gal Schlezinger --- Cargo.lock | 1 - Cargo.toml | 1 - src/commands/use.rs | 4 ++-- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8e3ca55..8df8849 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -592,7 +592,6 @@ name = "fnm" version = "1.33.1" dependencies = [ "anyhow", - "atty", "chrono", "clap", "clap_complete", diff --git a/Cargo.toml b/Cargo.toml index ee39212..e441450 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,6 @@ tempfile = "3.6.0" indoc = "2.0.1" log = "0.4.19" env_logger = "0.10.0" -atty = "0.2.14" encoding_rs_io = "0.1.7" reqwest = { version = "0.11.18", features = ["blocking", "json", "rustls-tls", "rustls-tls-native-roots", "brotli"], default-features = false } url = "2.4.0" diff --git a/src/commands/use.rs b/src/commands/use.rs index 3807d67..14bbfb4 100644 --- a/src/commands/use.rs +++ b/src/commands/use.rs @@ -159,9 +159,9 @@ fn replace_symlink(from: &std::path::Path, to: &std::path::Path) -> std::io::Res } fn should_install_interactively(requested_version: &UserVersion) -> bool { - use std::io::Write; + use std::io::{IsTerminal, Write}; - if !(atty::is(atty::Stream::Stdout) && atty::is(atty::Stream::Stdin)) { + if !(std::io::stdout().is_terminal() && std::io::stdin().is_terminal()) { return false; }