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.
This commit is contained in:
Benjamin Sago 2017-08-05 20:26:13 +01:00
parent d701547ec4
commit 4289f4d27e

View File

@ -392,7 +392,10 @@ impl Classify {
// so its easier to just cache it the first time it runs.
lazy_static! {
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 were only interested in stdout because its
// where the output goes.
use term_size::dimensions_stdout;
dimensions_stdout().map(|t| t.0)
};
}