mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +00:00
ps: Sort output by PID :^)
This commit is contained in:
parent
a1e133cc6b
commit
873eb47d2b
Notes:
sideshowbarker
2024-07-18 17:30:35 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/873eb47d2b0
1 changed files with 7 additions and 4 deletions
|
@ -1,9 +1,10 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2018-2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <AK/QuickSort.h>
|
||||
#include <LibCore/ArgsParser.h>
|
||||
#include <LibCore/File.h>
|
||||
#include <LibCore/ProcessStatisticsReader.h>
|
||||
|
@ -99,11 +100,13 @@ int main(int argc, char** argv)
|
|||
print_column(column, column.title);
|
||||
printf("\n");
|
||||
|
||||
auto all_processes = Core::ProcessStatisticsReader::get_all();
|
||||
if (!all_processes.has_value())
|
||||
auto processes = Core::ProcessStatisticsReader::get_all();
|
||||
if (!processes.has_value())
|
||||
return 1;
|
||||
|
||||
for (auto const& process : all_processes.value()) {
|
||||
quick_sort(processes.value(), [](auto& a, auto& b) { return a.pid < b.pid; });
|
||||
|
||||
for (auto const& process : processes.value()) {
|
||||
auto tty = process.tty;
|
||||
|
||||
if (!every_process_flag && tty != this_tty)
|
||||
|
|
Loading…
Reference in a new issue