use interactive_terminal

This commit is contained in:
Jonah Caplan 2021-10-16 14:33:21 -04:00
parent 82f04755bf
commit a41021b0d2

View file

@ -33,8 +33,6 @@ use crate::filter::OwnerFilter;
use crate::filter::{SizeFilter, TimeFilter}; use crate::filter::{SizeFilter, TimeFilter};
use crate::regex_helper::{pattern_has_uppercase_char, pattern_matches_strings_with_leading_dot}; use crate::regex_helper::{pattern_has_uppercase_char, pattern_matches_strings_with_leading_dot};
extern crate libc;
// We use jemalloc for performance reasons, see https://github.com/sharkdp/fd/pull/481 // We use jemalloc for performance reasons, see https://github.com/sharkdp/fd/pull/481
// FIXME: re-enable jemalloc on macOS, see comment in Cargo.toml file for more infos // FIXME: re-enable jemalloc on macOS, see comment in Cargo.toml file for more infos
#[cfg(all( #[cfg(all(
@ -252,8 +250,6 @@ fn construct_config(matches: clap::ArgMatches, pattern_regex: &str) -> Result<Co
}; };
let command = extract_command(&matches, path_separator.as_deref(), colored_output)?; let command = extract_command(&matches, path_separator.as_deref(), colored_output)?;
let istty = unsafe { libc::isatty(libc::STDOUT_FILENO as i32) } != 0;
Ok(Config { Ok(Config {
case_sensitive, case_sensitive,
search_full_path: matches.is_present("full-path"), search_full_path: matches.is_present("full-path"),
@ -379,7 +375,9 @@ fn construct_config(matches: clap::ArgMatches, pattern_regex: &str) -> Result<Co
None None
} }
}), }),
no_strip: matches.is_present("path") || matches.is_present("search-path") || !istty, no_strip: matches.is_present("path")
|| matches.is_present("search-path")
|| !interactive_terminal,
}) })
} }