Skip to content

Commit 8cdeb12

Browse files
authored
Merge pull request #1055 from amanjeev/amanjeev/clean-command
Fix (command:clean): removes error message 'dir not found' if 'clean' is run multiple times
2 parents 93c9ae5 + 74313bb commit 8cdeb12

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/cmd/clean.rs

Lines changed: 4 additions & 1 deletion
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)