Skip to content

Commit 32c9e91

Browse files
committed
test
1 parent dfa7310 commit 32c9e91

File tree

1 file changed

+18
-10
lines changed

1 file changed

+18
-10
lines changed

src/main.rs

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,10 @@ fn init_color_formatter(oma: &OhManagerAilurus, config: &Config) {
518518
// Ref: https://github.com/dalance/procs/commit/83305be6fb431695a070524328b66c7107ce98f3
519519
let timeout = Duration::from_millis(100);
520520

521+
dbg!(stdout().is_terminal());
522+
dbg!(stderr().is_terminal());
523+
dbg!(stdin().is_terminal());
524+
521525
if !stdout().is_terminal() || !stderr().is_terminal() || !stdin().is_terminal() || no_color
522526
{
523527
follow_term_color = true;
@@ -532,18 +536,22 @@ fn init_color_formatter(oma: &OhManagerAilurus, config: &Config) {
532536
"Unknown or unsupported terminal ($TERM is empty or unsupported) detected, using default terminal colors to avoid latency."
533537
);
534538
follow_term_color = true;
535-
} else if let Ok(latency) = termbg::latency(Duration::from_millis(1000)) {
536-
debug!("latency: {:?}", latency);
537-
if latency * 2 > timeout {
538-
debug!(
539-
"Terminal latency is too long, falling back to default terminal colors, latency: {:?}.",
540-
latency
541-
);
539+
} else {
540+
dbg!("Checking terminal latency...");
541+
if let Ok(latency) = termbg::latency(Duration::from_millis(1000)) {
542+
debug!("latency: {:?}", latency);
543+
if latency * 2 > timeout {
544+
debug!(
545+
"Terminal latency is too long, falling back to default terminal colors, latency: {:?}.",
546+
latency
547+
);
548+
follow_term_color = true;
549+
}
550+
} else {
551+
debug!("Terminal latency is too long, falling back to default terminal colors.");
542552
follow_term_color = true;
543553
}
544-
} else {
545-
debug!("Terminal latency is too long, falling back to default terminal colors.");
546-
follow_term_color = true;
554+
dbg!("Terminal latency check complete.");
547555
}
548556

549557
OmaColorFormat::new(follow_term_color, timeout)

0 commit comments

Comments
 (0)