Skip to content

Commit

Permalink
use IsTerminal trait (Rust 1.70.0), removing (direct) dependency on `…
Browse files Browse the repository at this point in the history
…atty` crate.
  • Loading branch information
OlsonZacheryFS committed Jul 31, 2023
1 parent 9e2df0c commit 3b5c128
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
1 change: 0 additions & 1 deletion 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 @@ -18,7 +18,6 @@ name = "test-server"
path = "src/bin/test_server.rs"

[dependencies]
atty = "0.2"
base64 = "0.21"
body_reader = { path = "./lib/body_reader" }
bytes = "1"
Expand Down
8 changes: 2 additions & 6 deletions src/bin/pewpew.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::io;
use std::io::{self, IsTerminal};

use futures::channel::mpsc as futures_channel;
use log::{debug, info};
Expand Down Expand Up @@ -180,11 +180,7 @@ fn main() {
Paint::disable();
}
}
// TODO: https://rustsec.org/advisories/RUSTSEC-2021-0145
// Consider
// - [is-terminal](https://crates.io/crates/is-terminal)
// - std::io::IsTerminal *nightly-only experimental*
if atty::isnt(atty::Stream::Stdout) {
if !io::stdout().is_terminal() {
Paint::disable();
}

Expand Down

0 comments on commit 3b5c128

Please sign in to comment.