From c272d26ae84ddf8ce1aa0456fbecedff102a64b0 Mon Sep 17 00:00:00 2001 From: Matt Mastracci Date: Fri, 25 Aug 2023 07:43:07 -0600 Subject: chore(cli): remove atty crate (#20275) Removes a crate with an outstanding vulnerability. --- cli/util/draw_thread.rs | 3 ++- cli/util/file_watcher.rs | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'cli/util') diff --git a/cli/util/draw_thread.rs b/cli/util/draw_thread.rs index 832c7f74b..352ead3b0 100644 --- a/cli/util/draw_thread.rs +++ b/cli/util/draw_thread.rs @@ -5,6 +5,7 @@ use deno_core::parking_lot::Mutex; use deno_core::unsync::spawn_blocking; use deno_runtime::ops::tty::ConsoleSize; use once_cell::sync::Lazy; +use std::io::IsTerminal; use std::sync::Arc; use std::time::Duration; @@ -70,7 +71,7 @@ static INTERNAL_STATE: Lazy>> = Lazy::new(|| { }); static IS_TTY_WITH_CONSOLE_SIZE: Lazy = Lazy::new(|| { - atty::is(atty::Stream::Stderr) + std::io::stderr().is_terminal() && console_size() .map(|s| s.cols > 0 && s.rows > 0) .unwrap_or(false) diff --git a/cli/util/file_watcher.rs b/cli/util/file_watcher.rs index ddeedb741..c0eda2d86 100644 --- a/cli/util/file_watcher.rs +++ b/cli/util/file_watcher.rs @@ -16,6 +16,7 @@ use notify::RecommendedWatcher; use notify::RecursiveMode; use notify::Watcher; use std::collections::HashSet; +use std::io::IsTerminal; use std::path::PathBuf; use std::sync::Arc; use std::time::Duration; @@ -98,7 +99,7 @@ pub struct PrintConfig { fn create_print_after_restart_fn(clear_screen: bool) -> impl Fn() { move || { - if clear_screen && atty::is(atty::Stream::Stderr) { + if clear_screen && std::io::stderr().is_terminal() { eprint!("{CLEAR_SCREEN}"); } info!( -- cgit v1.2.3