replace atty crate with std's isTerminal

This commit is contained in:
klensy 2023-07-26 18:09:50 +03:00
parent 52bdc37727
commit 31630859cc
5 changed files with 4 additions and 6 deletions

View File

@ -3732,7 +3732,6 @@ dependencies = [
name = "rustc_interface" name = "rustc_interface"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"atty",
"libloading", "libloading",
"rustc-rayon", "rustc-rayon",
"rustc-rayon-core", "rustc-rayon-core",
@ -4196,7 +4195,6 @@ dependencies = [
name = "rustc_session" name = "rustc_session"
version = "0.0.0" version = "0.0.0"
dependencies = [ dependencies = [
"atty",
"bitflags 1.3.2", "bitflags 1.3.2",
"getopts", "getopts",
"libc", "libc",

View File

@ -6,7 +6,6 @@ edition = "2021"
[lib] [lib]
[dependencies] [dependencies]
atty = "0.2.13"
libloading = "0.7.1" libloading = "0.7.1"
tracing = "0.1" tracing = "0.1"
rustc-rayon-core = { version = "0.5.0", optional = true } rustc-rayon-core = { version = "0.5.0", optional = true }

View File

@ -519,7 +519,8 @@ fn multiple_output_types_to_stdout(
output_types: &OutputTypes, output_types: &OutputTypes,
single_output_file_is_stdout: bool, single_output_file_is_stdout: bool,
) -> bool { ) -> bool {
if atty::is(atty::Stream::Stdout) { use std::io::IsTerminal;
if std::io::stdout().is_terminal() {
// If stdout is a tty, check if multiple text output types are // If stdout is a tty, check if multiple text output types are
// specified by `--emit foo=- --emit bar=-` or `-o - --emit foo,bar` // specified by `--emit foo=- --emit bar=-` or `-o - --emit foo,bar`
let named_text_types = output_types let named_text_types = output_types

View File

@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021" edition = "2021"
[dependencies] [dependencies]
atty = "0.2.13"
bitflags = "1.2.1" bitflags = "1.2.1"
getopts = "0.2" getopts = "0.2"
rustc_macros = { path = "../rustc_macros" } rustc_macros = { path = "../rustc_macros" }

View File

@ -834,9 +834,10 @@ impl OutFileName {
} }
pub fn is_tty(&self) -> bool { pub fn is_tty(&self) -> bool {
use std::io::IsTerminal;
match *self { match *self {
OutFileName::Real(_) => false, OutFileName::Real(_) => false,
OutFileName::Stdout => atty::is(atty::Stream::Stdout), OutFileName::Stdout => std::io::stdout().is_terminal(),
} }
} }