Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fs: fix regression on rmsync
  • Loading branch information
anonrig committed Jul 21, 2024
commit c2f5befae89ec67143079d8ea6b376a1da48f4b4
9 changes: 6 additions & 3 deletions src/node_file.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,8 @@ static void RmSync(const FunctionCallbackInfo<Value>& args) {
error == std::errc::operation_not_permitted);
};

int i = 1;

while (maxRetries >= 0) {
if (recursive) {
std::filesystem::remove_all(file_path, error);
Expand All @@ -1667,14 +1669,15 @@ static void RmSync(const FunctionCallbackInfo<Value>& args) {
break;
}

if (retryDelay != 0) {
if (retryDelay > 0) {
#ifdef _WIN32
Sleep(retryDelay / 1000);
Sleep(i * retryDelay / 1000);
#else
sleep(retryDelay / 1000);
sleep(i * retryDelay / 1000);
#endif
}
maxRetries--;
i++;
}

// This is required since std::filesystem::path::c_str() returns different
Expand Down