12 #ifndef __STOUT_OS_WINDOWS_RM_HPP__ 13 #define __STOUT_OS_WINDOWS_RM_HPP__ 39 for (
int i = 0; i < 10; ++i) {
41 const DWORD attributes =
43 CHECK_EQ(attributes, INVALID_FILE_ATTRIBUTES);
44 const DWORD
error = ::GetLastError();
46 if (error == ERROR_ACCESS_DENIED) {
47 LOG(WARNING) <<
"Waiting for file " << path <<
" to be deleted";
49 }
else if (error == ERROR_FILE_NOT_FOUND) {
57 return Error(
"Timed out when waiting for file " + path +
" to be deleted");
84 ? ::RemoveDirectoryW(longpath.data())
85 : ::DeleteFileW(longpath.data());
98 return Error(
"wait_on_delete failed " + deleted.
error());
106 #endif // __STOUT_OS_WINDOWS_RM_HPP__
Definition: nothing.hpp:16
Definition: errorbase.hpp:36
Try< Nothing > rm(const std::string &path)
Definition: rm.hpp:26
Try< Nothing > sleep(const Duration &duration)
Definition: os.hpp:219
Definition: error.hpp:108
Definition: posix_signalhandler.hpp:23
Try< Nothing > wait_on_delete(const std::string &path)
Definition: rm.hpp:36
Definition: duration.hpp:193
static Try error(const E &e)
Definition: try.hpp:43
Definition: attributes.hpp:24
bool isError() const
Definition: try.hpp:78
std::string error(const std::string &msg, uint32_t code)
bool isdir(const std::string &path, const FollowSymlink follow=FollowSymlink::FOLLOW_SYMLINK)
Definition: stat.hpp:91
std::wstring longpath(const std::string &path)
Definition: longpath.hpp:38