diff options
author | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-06-15 17:15:52 +0800 |
---|---|---|
committer | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-06-15 17:43:29 +0800 |
commit | 209eecf042761eba35be809ca22bc98af472acad (patch) | |
tree | 39b882a74eb976f3f809f379930e4e63abcaf037 /src/interactive | |
parent | 854dc46e1d99ce5c089369820351b9354707a300 (diff) |
Handle symlinks in a rather brutal way.
Diffstat (limited to 'src/interactive')
-rw-r--r-- | src/interactive/app/handlers.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/interactive/app/handlers.rs b/src/interactive/app/handlers.rs index cfbcb14..41aa963 100644 --- a/src/interactive/app/handlers.rs +++ b/src/interactive/app/handlers.rs @@ -274,6 +274,8 @@ fn delete_directory_recursively(path: PathBuf) -> Result<(), usize> { } } Err(ref e) if e.kind() == io::ErrorKind::NotFound => { + // it could also be a broken symlink + num_errors += into_error_count(fs::remove_file(path)); continue; } Err(ref e) if e.kind() == io::ErrorKind::Other => { @@ -289,7 +291,7 @@ fn delete_directory_recursively(path: PathBuf) -> Result<(), usize> { } for dir in dirs.into_iter().rev() { - num_errors += into_error_count(fs::remove_dir(dir)); + num_errors += into_error_count(fs::remove_dir(&dir).or_else(|_| fs::remove_file(dir))); } if num_errors == 0 { |