summaryrefslogtreecommitdiff
path: root/src/mongo/shell/shell_utils_launcher.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/shell/shell_utils_launcher.cpp')
-rw-r--r--src/mongo/shell/shell_utils_launcher.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/mongo/shell/shell_utils_launcher.cpp b/src/mongo/shell/shell_utils_launcher.cpp
index 8fcefa3e690..bf0e7644ec9 100644
--- a/src/mongo/shell/shell_utils_launcher.cpp
+++ b/src/mongo/shell/shell_utils_launcher.cpp
@@ -862,8 +862,18 @@ BSONObj ResetDbpath(const BSONObj& a, void* data) {
LOGV2_WARNING(22824, "ResetDbpath(): nothing to do, path was empty");
return undefinedReturn;
}
- if (boost::filesystem::exists(path))
- boost::filesystem::remove_all(path);
+ if (boost::filesystem::exists(path)) {
+ try {
+ boost::filesystem::remove_all(path);
+ } catch (const boost::filesystem::filesystem_error&) {
+#ifdef _WIN32
+ sleepmillis(100);
+ boost::filesystem::remove_all(path);
+#else
+ throw;
+#endif
+ }
+ }
boost::filesystem::create_directory(path);
return undefinedReturn;
}