diff options
| author | sam <haminoooin@gmail.com> | 2025-06-05 22:19:54 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-06-05 15:19:54 +0100 |
| commit | 59c886d85500cf4c8ae11eaf2ebe50ec25b596f6 (patch) | |
| tree | 67ee4639661ea66e067b194b22376584a578373a /hyprctl | |
| parent | d7a87ce6e2535f1029fc93b062d2828e8549c525 (diff) | |
internal: Catch filesystem exceptions while iterating RunTimeDir (#10648)
Diffstat (limited to 'hyprctl')
| -rw-r--r-- | hyprctl/main.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/hyprctl/main.cpp b/hyprctl/main.cpp index 25a4eef3..4a8b9819 100644 --- a/hyprctl/main.cpp +++ b/hyprctl/main.cpp @@ -72,10 +72,13 @@ std::vector<SInstanceData> instances() { return {}; } catch (std::exception& e) { return {}; } - for (const auto& el : std::filesystem::directory_iterator(getRuntimeDir())) { + std::error_code ec; + std::filesystem::directory_iterator it = std::filesystem::directory_iterator(getRuntimeDir(), std::filesystem::directory_options::skip_permission_denied, ec); + if (ec) + return {}; + for (const auto& el : it) { if (!el.is_directory() || !std::filesystem::exists(el.path().string() + "/hyprland.lock")) continue; - // read lock SInstanceData* data = &result.emplace_back(); data->id = el.path().filename().string(); |
