Răsfoiți Sursa

Specify that we need the width of stdout

The term_size crate introduced in #237 did things *slightly* differently than exa: it tried to get the terminal width of stdout, stderr, and stdin. This broke some tests that only redirected stdout.
Benjamin Sago 8 ani în urmă
părinte
comite
4289f4d27e
1 a modificat fișierele cu 5 adăugiri și 2 ștergeri
  1. 5 2
      src/options/view.rs

+ 5 - 2
src/options/view.rs

@@ -392,7 +392,10 @@ impl Classify {
 // so it’s easier to just cache it the first time it runs.
 // so it’s easier to just cache it the first time it runs.
 lazy_static! {
 lazy_static! {
     static ref TERM_WIDTH: Option<usize> = {
     static ref TERM_WIDTH: Option<usize> = {
-        use term_size::dimensions;
-        dimensions().map(|t| t.0)
+        // All of stdin, stdout, and stderr could not be connected to a
+        // terminal, but we’re only interested in stdout because it’s
+        // where the output goes.
+        use term_size::dimensions_stdout;
+        dimensions_stdout().map(|t| t.0)
     };
     };
 }
 }