From 2687b81dc065b43a8e6736773fa9d304eae09e3c Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 23 Aug 2024 13:24:53 +0200 Subject: [PATCH] chore(drive): remove atty due to RUSTSEC-2021-0145 --- packages/rs-drive-abci/Cargo.toml | 1 - packages/rs-drive-abci/src/logging/logger.rs | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/packages/rs-drive-abci/Cargo.toml b/packages/rs-drive-abci/Cargo.toml index 1a7975e37a..0cbb9cb847 100644 --- a/packages/rs-drive-abci/Cargo.toml +++ b/packages/rs-drive-abci/Cargo.toml @@ -49,7 +49,6 @@ tracing-subscriber = { version = "0.3.16", default-features = false, features = "registry", "tracing-log", ], optional = false } -atty = { version = "0.2.14", optional = false } tenderdash-abci = { git = "https://github.com/dashpay/rs-tenderdash-abci", version = "1.1.0", tag = "v1.1.0", features = [ "grpc", ] } diff --git a/packages/rs-drive-abci/src/logging/logger.rs b/packages/rs-drive-abci/src/logging/logger.rs index 121ce76b93..6646a783c8 100644 --- a/packages/rs-drive-abci/src/logging/logger.rs +++ b/packages/rs-drive-abci/src/logging/logger.rs @@ -5,7 +5,7 @@ use crate::logging::{LogConfigs, LogFormat, LogLevel}; use lazy_static::__Deref; use std::collections::HashMap; use std::fmt::Debug; -use std::io::Write; +use std::io::{IsTerminal, Write}; use std::sync::Arc; use std::sync::Mutex; use tracing_subscriber::fmt; @@ -305,9 +305,9 @@ impl Logger { fn layer(&self) -> Result, Error> { let ansi = self .color - .unwrap_or(match self.destination.lock().unwrap().deref() { - LogDestinationWriter::StdOut => atty::is(atty::Stream::Stdout), - LogDestinationWriter::StdErr => atty::is(atty::Stream::Stderr), + .unwrap_or_else(|| match self.destination.lock().unwrap().deref() { + LogDestinationWriter::StdOut => std::io::stdout().is_terminal(), + LogDestinationWriter::StdErr => std::io::stderr().is_terminal(), _ => false, });