diff options
author | Canop <cano.petrole@gmail.com> | 2022-07-04 23:12:07 +0200 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2022-07-04 23:12:07 +0200 |
commit | 95713a43e63ca2a3f989a459ade827e12728454a (patch) | |
tree | 5b6bf5092e60a50b274407333b6441f9f73429ff /src/display | |
parent | 4bab33f4ddcf89f738bdad2980819895f2d3c4f8 (diff) |
don't test luma when terminal isn't TTY
because a luma test may write some characters in the
standard output
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/luma.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/display/luma.rs b/src/display/luma.rs index 27bf877..c9e9105 100644 --- a/src/display/luma.rs +++ b/src/display/luma.rs @@ -1,4 +1,6 @@ pub use { + crate::cli::{Args, TriBool}, + crossterm::tty::IsTty, once_cell::sync::Lazy, serde::Deserialize, }; @@ -41,7 +43,12 @@ pub enum LumaCondition { impl LumaCondition { pub fn is_verified(&self) -> bool { - self.includes(Luma::read()) + let luma = if std::io::stdout().is_tty() { + Luma::read() + } else { + Luma::Unknown + }; + self.includes(luma) } pub fn includes(&self, other: Luma) -> bool { match self { |