diff options
author | Tim Schumacher <timschumi@gmx.de> | 2022-12-08 14:50:31 +0100 |
---|---|---|
committer | Linus Groh <mail@linusgroh.de> | 2022-12-10 11:49:24 +0000 |
commit | 8940f2da7fec4b4e375777c861e65ff04465f255 (patch) | |
tree | d1ac58cae77af94ea378a93fb818e8787faed542 /Userland/Services/WindowServer | |
parent | e338a0656dd8e99e9ed64abf98d15e219adb9755 (diff) | |
download | serenity-8940f2da7fec4b4e375777c861e65ff04465f255.zip |
LibCore: Use `Core::Stream` for `ProcessStatisticsReader`
Diffstat (limited to 'Userland/Services/WindowServer')
-rw-r--r-- | Userland/Services/WindowServer/Window.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/Userland/Services/WindowServer/Window.cpp b/Userland/Services/WindowServer/Window.cpp index 8619863ef7..f07c97484c 100644 --- a/Userland/Services/WindowServer/Window.cpp +++ b/Userland/Services/WindowServer/Window.cpp @@ -1073,15 +1073,13 @@ ErrorOr<Optional<DeprecatedString>> Window::compute_title_username(ConnectionFro { if (!client) return Error::from_string_literal("Tried to compute title username without a client"); - auto stats = Core::ProcessStatisticsReader::get_all(true); - if (!stats.has_value()) - return Error::from_string_literal("Failed to get all process statistics"); + auto stats = TRY(Core::ProcessStatisticsReader::get_all(true)); pid_t client_pid = TRY(client->socket().peer_pid()); - auto client_stat = stats.value().processes.first_matching([&](auto& stat) { return stat.pid == client_pid; }); + auto client_stat = stats.processes.first_matching([&](auto& stat) { return stat.pid == client_pid; }); if (!client_stat.has_value()) return Error::from_string_literal("Failed to find client process stat"); pid_t login_session_pid = TRY(Core::SessionManagement::root_session_id(client_pid)); - auto login_session_stat = stats.value().processes.first_matching([&](auto& stat) { return stat.pid == login_session_pid; }); + auto login_session_stat = stats.processes.first_matching([&](auto& stat) { return stat.pid == login_session_pid; }); if (!login_session_stat.has_value()) return Error::from_string_literal("Failed to find login process stat"); if (login_session_stat.value().uid == client_stat.value().uid) |