Skip to content

Commit 4b2871d

Browse files
authored
Merge pull request rust-lang#1055 from amanjeev/amanjeev/clean-command
Fix (command:clean): removes error message 'dir not found' if 'clean' is run multiple times
2 parents 54b9710 + 6eb0c4b commit 4b2871d

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cmd/clean.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,10 @@ pub fn execute(args: &ArgMatches) -> mdbook::errors::Result<()> {
2929
Some(dest_dir) => dest_dir.into(),
3030
None => book.root.join(&book.config.build.build_dir),
3131
};
32-
fs::remove_dir_all(&dir_to_remove).chain_err(|| "Unable to remove the build directory")?;
32+
33+
if dir_to_remove.exists() {
34+
fs::remove_dir_all(&dir_to_remove).chain_err(|| "Unable to remove the build directory")?;
35+
}
3336

3437
Ok(())
3538
}

0 commit comments

Comments
 (0)