Skip to content

replace atty crate with std's IsTerminal #114098

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

Merged
merged 1 commit into from
Jul 27, 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
Original file line number Diff line number Diff line change
Expand Up @@ -3732,7 +3732,6 @@ dependencies = [
name = "rustc_interface"
version = "0.0.0"
dependencies = [
"atty",
"libloading",
"rustc-rayon",
"rustc-rayon-core",
Expand Down Expand Up @@ -4196,7 +4195,6 @@ dependencies = [
name = "rustc_session"
version = "0.0.0"
dependencies = [
"atty",
"bitflags 1.3.2",
"getopts",
"libc",
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_interface/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ edition = "2021"
[lib]

[dependencies]
atty = "0.2.13"
libloading = "0.7.1"
tracing = "0.1"
rustc-rayon-core = { version = "0.5.0", optional = true }
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_interface/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -519,7 +519,8 @@ fn multiple_output_types_to_stdout(
output_types: &OutputTypes,
single_output_file_is_stdout: 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
// specified by `--emit foo=- --emit bar=-` or `-o - --emit foo,bar`
let named_text_types = output_types
Expand Down
1 change: 0 additions & 1 deletion compiler/rustc_session/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ version = "0.0.0"
edition = "2021"

[dependencies]
atty = "0.2.13"
bitflags = "1.2.1"
getopts = "0.2"
rustc_macros = { path = "../rustc_macros" }
Expand Down
3 changes: 2 additions & 1 deletion compiler/rustc_session/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -834,9 +834,10 @@ impl OutFileName {
}

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

Expand Down