diff options
author | Antoine PLASKOWSKI <plaskowski.stanislas@gmail.com> | 2021-02-26 17:44:17 +0100 |
---|---|---|
committer | Antoine PLASKOWSKI <plaskowski.stanislas@gmail.com> | 2021-02-26 18:14:48 +0100 |
commit | 538a43b16c500d25d37bd6bcfb2936df89b918fc (patch) | |
tree | 74511a98472bc05305703e0d5b7cd85803b6e177 /src/cli | |
parent | ee7c3198e1ec99246926f3d17b9f6bd248128aec (diff) |
Closes https://github.com/Canop/broot/issues/351
Diffstat (limited to 'src/cli')
-rw-r--r-- | src/cli/mod.rs | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/cli/mod.rs b/src/cli/mod.rs index c92d41f..78e32eb 100644 --- a/src/cli/mod.rs +++ b/src/cli/mod.rs @@ -28,10 +28,11 @@ use { event::{DisableMouseCapture, EnableMouseCapture}, terminal::{EnterAlternateScreen, LeaveAlternateScreen}, QueueableCommand, + tty::IsTty, }, std::{ env, - io::{self, Write}, + io::{self, Write, stdout}, path::{Path, PathBuf}, }, }; @@ -75,7 +76,7 @@ fn get_root_path(cli_args: &ArgMatches<'_>) -> Result<PathBuf, ProgramError> { } fn is_output_piped() -> bool { - unsafe { libc::isatty(libc::STDOUT_FILENO) == 0 } + !stdout().is_tty() } fn is_no_style(cli_matches: &ArgMatches) -> bool { |