summaryrefslogtreecommitdiff
path: root/Userland/Applications/SystemMonitor
diff options
context:
space:
mode:
authorMacDue <macdue@dueutil.tech>2022-05-26 23:28:58 +0100
committerLinus Groh <mail@linusgroh.de>2022-06-03 12:29:56 +0100
commit5fd5a03d1f6ac0d4d0ad29cb01752502fe8ebc0d (patch)
treef6e70c3063932822ac3374da4326d29d40d6f4d5 /Userland/Applications/SystemMonitor
parent5e5a055455be0cd8d8784e83e9e80cb4822970ea (diff)
downloadserenity-5fd5a03d1f6ac0d4d0ad29cb01752502fe8ebc0d.zip
Applications: Use spawn_or_show_error() for common spawn pattern
Diffstat (limited to 'Userland/Applications/SystemMonitor')
-rw-r--r--Userland/Applications/SystemMonitor/main.cpp16
1 files changed, 5 insertions, 11 deletions
diff --git a/Userland/Applications/SystemMonitor/main.cpp b/Userland/Applications/SystemMonitor/main.cpp
index 17c9031f5c..a97f4c3a12 100644
--- a/Userland/Applications/SystemMonitor/main.cpp
+++ b/Userland/Applications/SystemMonitor/main.cpp
@@ -38,6 +38,7 @@
#include <LibGUI/Menubar.h>
#include <LibGUI/MessageBox.h>
#include <LibGUI/Painter.h>
+#include <LibGUI/Process.h>
#include <LibGUI/SeparatorWidget.h>
#include <LibGUI/SortingProxyModel.h>
#include <LibGUI/StackWidget.h>
@@ -470,17 +471,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
"&Profile Process", { Mod_Ctrl, Key_P },
Gfx::Bitmap::try_load_from_file("/res/icons/16x16/app-profiler.png").release_value_but_fixme_should_propagate_errors(), [&](auto&) {
pid_t pid = selected_id(ProcessModel::Column::PID);
- if (pid != -1) {
- auto pid_string = String::number(pid);
- pid_t child;
- const char* argv[] = { "/bin/Profiler", "--pid", pid_string.characters(), nullptr };
- if ((errno = posix_spawn(&child, "/bin/Profiler", nullptr, nullptr, const_cast<char**>(argv), environ))) {
- perror("posix_spawn");
- } else {
- if (disown(child) < 0)
- perror("disown");
- }
- }
+ if (pid == -1)
+ return;
+ auto pid_string = String::number(pid);
+ GUI::Process::spawn_or_show_error(window, "/bin/Profiler", Array { "--pid", pid_string.characters() });
},
&process_table_view);