From 09c6105f17f3988c9e326d7a5d552b270fff64e8 Mon Sep 17 00:00:00 2001 From: tottoto Date: Mon, 12 Jun 2023 20:04:48 +0900 Subject: [PATCH] Replace atty with std::io::IsTerminal --- 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 73fe5ee60..74b49c843 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -628,7 +628,6 @@ name = "fnm" version = "1.33.1" dependencies = [ "anyhow", - "atty", "chrono", "clap", "clap_complete", diff --git a/Cargo.toml b/Cargo.toml index ba832bccb..859a47942 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,6 @@ tempfile = "3.3.0" indoc = "1.0.8" log = "0.4.17" env_logger = "0.10.0" -atty = "0.2.14" encoding_rs_io = "0.1.7" reqwest = { version = "0.11.13", features = ["blocking", "json", "rustls-tls", "rustls-tls-native-roots", "brotli"], default-features = false } url = "2.3.1" diff --git a/src/commands/use.rs b/src/commands/use.rs index 70375dd8c..c23e1bfe5 100644 --- a/src/commands/use.rs +++ b/src/commands/use.rs @@ -158,9 +158,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; }