Windows: qualify ConfigurationAsync, MCP, Resilience, ResilienceAsync, Script, LogConfig, FunctionalCoreFormatting and SystemAsync
- AsyncWatcher: implement Windows path probing (size, mtime, type, symlink target through std::filesystem) - it was a no-op, so polling watchers never observed changes. - ConfigurationAsync test: poll until the asynchronous file event is delivered instead of assuming one poll. - SystemAsync shutdown test: skip on Windows (POSIX process helper). Windows cross build under Wine 11 (x86_64-w64-mingw32 GCC 16.2): 1178 tests, 1162 passed, 16 skipped, 0 failed.
This commit is contained in:
1 parent
c6ba2f42b5
commit
8510ea197f
4 files changed
+62
-3
No files matched your search
@@ -8,6 +8,7 @@
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cerrno>
|
||||
#include <chrono>
|
||||
#include <condition_variable>
|
||||
#include <cstdint>
|
||||
#include <deque>
|
||||
@@ -90,7 +91,43 @@ struct PathSnapshot {
|
||||
}
|
||||
}
|
||||
#else
|
||||
(void)path;
|
||||
// Windows: the same fields through std::filesystem (no device/inode
|
||||
// identity; size, mtime and type drive change detection).
|
||||
std::error_code ec;
|
||||
const auto status = std::filesystem::symlink_status(path, ec);
|
||||
if (ec) {
|
||||
snap.sys_errno = ec.value();
|
||||
snap.permission_denied = ec == std::errc::permission_denied;
|
||||
return snap;
|
||||
}
|
||||
snap.exists = std::filesystem::exists(status);
|
||||
if (!snap.exists) {
|
||||
snap.sys_errno = ENOENT;
|
||||
return snap;
|
||||
}
|
||||
snap.is_symlink = std::filesystem::is_symlink(status);
|
||||
if (std::filesystem::is_directory(status)) {
|
||||
snap.mode = 0040755U; // S_IFDIR | 0755
|
||||
} else {
|
||||
snap.mode = 0100644U; // S_IFREG | 0644
|
||||
snap.size = std::filesystem::file_size(path, ec);
|
||||
if (ec) {
|
||||
snap.size = 0;
|
||||
ec.clear();
|
||||
}
|
||||
}
|
||||
const auto mtime = std::filesystem::last_write_time(path, ec);
|
||||
if (!ec) {
|
||||
snap.mtime_ns = std::chrono::duration_cast<std::chrono::nanoseconds>(
|
||||
mtime.time_since_epoch())
|
||||
.count();
|
||||
}
|
||||
if (snap.is_symlink) {
|
||||
const auto target = std::filesystem::read_symlink(path, ec);
|
||||
if (!ec) {
|
||||
snap.symlink_target = target.string();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
return snap;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user