Skip to content

Commit 371580c

Browse files
authored
chore(deps): Remove usages of atty (#18985)
Turns out this is in the stdlib now. Replaces: #18966 Signed-off-by: Jesse Szwedko <jesse.szwedko@datadoghq.com>
1 parent 21f741d commit 371580c

File tree

6 files changed

+10
-7
lines changed

6 files changed

+10
-7
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,6 @@ mlua = { version = "0.9.1", default-features = false, features = ["lua54", "send
332332
windows-service = "0.6.0"
333333

334334
[target.'cfg(unix)'.dependencies]
335-
atty = { version = "0.2.14", default-features = false }
336335
nix = { version = "0.26.2", default-features = false, features = ["socket", "signal"] }
337336

338337
[build-dependencies]

src/cli.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,10 @@ impl Color {
333333
pub fn use_color(&self) -> bool {
334334
match self {
335335
#[cfg(unix)]
336-
Color::Auto => atty::is(atty::Stream::Stdout),
336+
Color::Auto => {
337+
use std::io::IsTerminal;
338+
std::io::stdout().is_terminal()
339+
}
337340
#[cfg(windows)]
338341
Color::Auto => false, // ANSI colors are not supported by cmd.exe
339342
Color::Always => true,

src/test_util/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,10 @@ pub fn next_addr_v6() -> SocketAddr {
122122

123123
pub fn trace_init() {
124124
#[cfg(unix)]
125-
let color = atty::is(atty::Stream::Stdout);
125+
let color = {
126+
use std::io::IsTerminal;
127+
std::io::stdout().is_terminal()
128+
};
126129
// Windows: ANSI colors are not supported by cmd.exe
127130
// Color is false for everything except unix.
128131
#[cfg(not(unix))]

vdev/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ publish = false
99

1010
[dependencies]
1111
anyhow = "1.0.75"
12-
atty = "0.2.14"
1312
cached = "0.46.0"
1413
chrono = { version = "0.4.31", default-features = false, features = ["serde", "clock"] }
1514
clap = { version = "4.4.7", features = ["derive"] }

vdev/src/util.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::ffi::{OsStr, OsString};
2+
use std::io::IsTerminal;
23
use std::process::{Command, Output};
34
use std::{collections::BTreeMap, fmt::Debug, fs, io::ErrorKind, path::Path};
45

@@ -7,7 +8,7 @@ use once_cell::sync::Lazy;
78
use serde::Deserialize;
89
use serde_json::Value;
910

10-
pub static IS_A_TTY: Lazy<bool> = Lazy::new(|| atty::is(atty::Stream::Stdout));
11+
pub static IS_A_TTY: Lazy<bool> = Lazy::new(|| std::io::stdout().is_terminal());
1112

1213
#[derive(Deserialize)]
1314
pub struct CargoTomlPackage {

0 commit comments

Comments
 (0)