Browse Source

fix(file): exit 13 on os error 13

Closes: #319

Signed-off-by: Christina Sørensen <christina@cafkafk.com>
Christina Sørensen 2 năm trước cách đây
mục cha
commit
1054eb6568
1 tập tin đã thay đổi với 4 bổ sung0 xóa
  1. 4 0
      src/main.rs

+ 4 - 0
src/main.rs

@@ -231,6 +231,10 @@ impl<'args> Exa<'args> {
                         trace!("matching on to_dir");
                         trace!("matching on to_dir");
                         match f.to_dir() {
                         match f.to_dir() {
                             Ok(d)   => dirs.push(d),
                             Ok(d)   => dirs.push(d),
+                            Err(e) if e.kind() == ErrorKind::PermissionDenied => {
+                                warn!("Permission Denied: {e}");
+                                exit(exits::PERMISSION_DENIED);
+                            },
                             Err(e)  => writeln!(io::stderr(), "{file_path:?}: {e}")?,
                             Err(e)  => writeln!(io::stderr(), "{file_path:?}: {e}")?,
                         }
                         }
                     }
                     }