Merge pull request #1055 from amanjeev/amanjeev/clean-command

Fix (command:clean): removes error message 'dir not found' if 'clean' is run multiple times
This commit is contained in:
Eric Huss 2019-10-05 14:03:31 -07:00 committed by GitHub
commit 8cdeb121c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -29,7 +29,10 @@ pub fn execute(args: &ArgMatches) -> mdbook::errors::Result<()> {
Some(dest_dir) => dest_dir.into(),
None => book.root.join(&book.config.build.build_dir),
};
if dir_to_remove.exists() {
fs::remove_dir_all(&dir_to_remove).chain_err(|| "Unable to remove the build directory")?;
}
Ok(())
}