mirror of
https://github.com/rust-lang/cargo.git
synced 2025-10-01 11:30:39 +00:00
Fall back to fs::remove_dir_all
on error
This commit is contained in:
parent
b07456e4ef
commit
ddc49783ce
@ -417,7 +417,10 @@ fn _create_dir_all(p: &Path) -> Result<()> {
|
|||||||
///
|
///
|
||||||
/// This does *not* follow symlinks.
|
/// This does *not* follow symlinks.
|
||||||
pub fn remove_dir_all<P: AsRef<Path>>(p: P) -> Result<()> {
|
pub fn remove_dir_all<P: AsRef<Path>>(p: P) -> Result<()> {
|
||||||
_remove_dir_all(p.as_ref())
|
_remove_dir_all(p.as_ref()).or_else(|_| {
|
||||||
|
fs::remove_dir_all(p.as_ref())
|
||||||
|
.with_context(|| format!("failed to remove directory `{}`", p.as_ref().display()))
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
fn _remove_dir_all(p: &Path) -> Result<()> {
|
fn _remove_dir_all(p: &Path) -> Result<()> {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user