mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 08:17:35 +00:00
LibCore: Report error condition when reading process statistics failed
This commit is contained in:
parent
754bf22da7
commit
cf89180c35
12 changed files with 94 additions and 74 deletions
|
@ -40,8 +40,10 @@ static int pid_of(const String& process_name, bool single_shot, bool omit_pid, p
|
|||
bool displayed_at_least_one = false;
|
||||
|
||||
auto processes = Core::ProcessStatisticsReader().get_all();
|
||||
if (!processes.has_value())
|
||||
return 1;
|
||||
|
||||
for (auto& it : processes) {
|
||||
for (auto& it : processes.value()) {
|
||||
if (it.value.name == process_name) {
|
||||
if (!omit_pid || it.value.pid != pid) {
|
||||
printf(" %d" + (displayed_at_least_one ? 0 : 1), it.value.pid);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue