Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): Remove usages of atty #18985

Merged
merged 2 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -338,7 +338,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
Loading