diff options
-rw-r--r-- | src/state.rs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/state.rs b/src/state.rs index 645a4b6..ed7f196 100644 --- a/src/state.rs +++ b/src/state.rs @@ -1,4 +1,5 @@ use std::fs::read_dir; +use std::io; use std::path::{Path, PathBuf}; use eyre::Result; @@ -13,7 +14,12 @@ pub struct State { // Heartbreaking: E0733 fn find_repos_in(dir: impl AsRef<Path>) -> Result<Vec<Repository>> { let dir = dir.as_ref(); - let dir = read_dir(dir)?; + let dir = read_dir(dir); + let dir = match dir { + Ok(x) => x, + Err(err) if err.kind() == io::ErrorKind::PermissionDenied => return Ok(vec![]), + Err(err) => Err(err)?, + }; let mut result = vec![]; for subdir in dir { if let Ok(subdir) = subdir { |