Skip to content

Commit

Permalink
Replace atty dependency with std::io::IsTerminal (#929)
Browse files Browse the repository at this point in the history
Closes #924
  • Loading branch information
LukasKalbertodt authored Sep 11, 2023
2 parents 694f1f7 + acac4af commit 72e100b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 25 deletions.
21 changes: 0 additions & 21 deletions backend/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 backend/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ embed-in-debug = ["reinda/debug-is-prod"]

[dependencies]
anyhow = { version = "1.0.71", features = ["backtrace"] }
atty = "0.2.14"
base64 = "0.21.0"
bincode = "1.3.3"
bstr = "1.4.0"
Expand Down
6 changes: 3 additions & 3 deletions backend/src/args.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
//! This module defines the command line arguments Tobira accepts.
use std::path::PathBuf;
use std::{path::PathBuf, io::IsTerminal};

use termcolor::ColorChoice;

Expand Down Expand Up @@ -127,10 +127,10 @@ fn parse_color_choice(s: &str) -> Result<ColorChoice, &'static str> {

impl Args {
pub(crate) fn stdout_color(&self) -> ColorChoice {
if atty::is(atty::Stream::Stdout) { self.color } else { ColorChoice::Never }
if std::io::stdout().is_terminal() { self.color } else { ColorChoice::Never }
}

pub(crate) fn stderr_color(&self) -> ColorChoice {
if atty::is(atty::Stream::Stderr) { self.color } else { ColorChoice::Never }
if std::io::stderr().is_terminal() { self.color } else { ColorChoice::Never }
}
}

0 comments on commit 72e100b

Please sign in to comment.