Skip to content

Commit

Permalink
chore(deps): Remove usages of atty (vectordotdev#18985)
Browse files Browse the repository at this point in the history
Turns out this is in the stdlib now.

Replaces: vectordotdev#18966

Signed-off-by: Jesse Szwedko <[email protected]>
  • Loading branch information
jszwedko authored and AndrooTheChen committed Sep 23, 2024
1 parent 5bfd73b commit 1b5b1fb
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 7 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ mlua = { version = "0.9.1", default-features = false, features = ["lua54", "send
windows-service = "0.6.0"

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

[build-dependencies]
Expand Down
5 changes: 4 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,10 @@ impl Color {
pub fn use_color(&self) -> bool {
match self {
#[cfg(unix)]
Color::Auto => atty::is(atty::Stream::Stdout),
Color::Auto => {
use std::io::IsTerminal;
std::io::stdout().is_terminal()
}
#[cfg(windows)]
Color::Auto => false, // ANSI colors are not supported by cmd.exe
Color::Always => true,
Expand Down
5 changes: 4 additions & 1 deletion src/test_util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ pub fn next_addr_v6() -> SocketAddr {

pub fn trace_init() {
#[cfg(unix)]
let color = atty::is(atty::Stream::Stdout);
let color = {
use std::io::IsTerminal;
std::io::stdout().is_terminal()
};
// Windows: ANSI colors are not supported by cmd.exe
// Color is false for everything except unix.
#[cfg(not(unix))]
Expand Down
1 change: 0 additions & 1 deletion vdev/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ publish = false

[dependencies]
anyhow = "1.0.75"
atty = "0.2.14"
cached = "0.46.0"
chrono = { version = "0.4.31", default-features = false, features = ["serde", "clock"] }
clap = { version = "4.4.7", features = ["derive"] }
Expand Down
3 changes: 2 additions & 1 deletion vdev/src/util.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::ffi::{OsStr, OsString};
use std::io::IsTerminal;
use std::process::{Command, Output};
use std::{collections::BTreeMap, fmt::Debug, fs, io::ErrorKind, path::Path};

Expand All @@ -7,7 +8,7 @@ use once_cell::sync::Lazy;
use serde::Deserialize;
use serde_json::Value;

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

#[derive(Deserialize)]
pub struct CargoTomlPackage {
Expand Down

0 comments on commit 1b5b1fb

Please sign in to comment.