Skip to content

Commit 7f57a7d

Browse files
committed
graph, node: Remove the use of atty
std::io::IsTerminal provides the same functionality. Fixes #6026
1 parent 8c87348 commit 7f57a7d

File tree

5 files changed

+12
-29
lines changed

5 files changed

+12
-29
lines changed

Cargo.lock

Lines changed: 0 additions & 21 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

graph/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ diesel_derives = { workspace = true }
2626
chrono = "0.4.43"
2727
envconfig = { workspace = true }
2828
Inflector = "0.11.3"
29-
atty = "0.2"
3029
reqwest = { version = "0.12.23", features = ["json", "stream", "multipart"] }
3130
ethabi = "17.2"
3231
hex = "0.4.3"

graph/src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ pub mod prelude {
7878
pub use ::anyhow;
7979
pub use alloy;
8080
pub use anyhow::{anyhow, Context as _, Error};
81-
pub use atty;
8281
pub use chrono;
8382
pub use diesel;
8483
pub use envconfig;

graph/src/log/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,15 @@ macro_rules! impl_slog_value {
1717
};
1818
}
1919

20-
use atty;
2120
use slog::*;
2221
use slog_async;
2322
use slog_envlogger;
2423
use slog_term::*;
25-
use std::{fmt, io, result};
24+
use std::{
25+
fmt,
26+
io::{self, IsTerminal},
27+
result,
28+
};
2629

2730
use crate::prelude::ENV_VARS;
2831

@@ -36,7 +39,7 @@ pub fn logger(show_debug: bool) -> Logger {
3639
}
3740

3841
pub fn logger_with_levels(show_debug: bool, levels: Option<&str>) -> Logger {
39-
let use_color = atty::is(atty::Stream::Stdout);
42+
let use_color = io::stdout().is_terminal();
4043
let decorator = slog_term::TermDecorator::new().build();
4144
let drain = CustomFormat::new(decorator, use_color).fuse();
4245
let drain = slog_envlogger::LogBuilder::new(drain)

node/src/manager/color.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
use std::{io, sync::Mutex};
1+
use std::{
2+
io::{self, IsTerminal as _},
3+
sync::Mutex,
4+
};
25
use termcolor::{Color, ColorChoice, ColorSpec, StandardStream, WriteColor};
36

4-
use graph::prelude::{atty, lazy_static};
7+
use graph::prelude::lazy_static;
58

69
use super::CmdResult;
710

@@ -27,7 +30,7 @@ impl Terminal {
2730
"always" => ColorChoice::Always,
2831
"ansi" => ColorChoice::AlwaysAnsi,
2932
"auto" => {
30-
if atty::is(atty::Stream::Stdout) {
33+
if io::stdout().is_terminal() {
3134
ColorChoice::Auto
3235
} else {
3336
ColorChoice::Never

0 commit comments

Comments
 (0)