diff options
author | Pierre Peltier <pierre.peltier@adevinta.com> | 2019-12-11 10:46:41 +0100 |
---|---|---|
committer | Pierre Peltier <8608160+Peltoche@users.noreply.github.com> | 2020-01-07 16:40:58 +0100 |
commit | 87e87d87cdf91d7e8a3f385b0a5beb96ddbd8824 (patch) | |
tree | 0f1f6067a28d596c41fcb714abe11967ebccb8c0 /src/core.rs | |
parent | 748a2722a2688b44d8d70d3f87899dccbf66f937 (diff) |
Do not panic if the pipes a closed before all the output is written
Diffstat (limited to 'src/core.rs')
-rw-r--r-- | src/core.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/core.rs b/src/core.rs index 60c73e7..6a120b3 100644 --- a/src/core.rs +++ b/src/core.rs @@ -3,7 +3,7 @@ use crate::display; use crate::flags::{Display, Flags, IconTheme, Layout, WhenFlag}; use crate::icon::{self, Icons}; use crate::meta::Meta; -use crate::sort; +use crate::{print_error, print_output, sort}; use std::fs; use std::path::PathBuf; @@ -84,14 +84,14 @@ impl Core { for path in paths { if let Err(err) = fs::canonicalize(&path) { - eprintln!("cannot access '{}': {}", path.display(), err); + print_error!("cannot access '{}': {}", path.display(), err); continue; } let mut meta = match Meta::from_path(&path) { Ok(meta) => meta, Err(err) => { - eprintln!("cannot access '{}': {}", path.display(), err); + print_error!("cannot access '{}': {}", path.display(), err); continue; } }; @@ -107,7 +107,7 @@ impl Core { meta_list.push(meta); } Err(err) => { - eprintln!("cannot access '{}': {}", path.display(), err); + print_error!("cannot access '{}': {}", path.display(), err); continue; } }; @@ -140,6 +140,6 @@ impl Core { display::grid(&metas, &self.flags, &self.colors, &self.icons) }; - print!("{}", output); + print_output!("{}", output); } } |