From 4289f4d27e28c1fb0086c4a75c376075347e3476 Mon Sep 17 00:00:00 2001 From: Benjamin Sago Date: Sat, 5 Aug 2017 20:26:13 +0100 Subject: [PATCH] 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. --- src/options/view.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/options/view.rs b/src/options/view.rs index c634dca..fda555c 100644 --- a/src/options/view.rs +++ b/src/options/view.rs @@ -392,7 +392,10 @@ impl Classify { // so it’s easier to just cache it the first time it runs. lazy_static! { static ref TERM_WIDTH: Option = { - 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) }; }