From 5aad6a4378c14c7fe12c2a719c6d668fd6e93c4f Mon Sep 17 00:00:00 2001 From: MacDue Date: Thu, 26 May 2022 23:30:32 +0100 Subject: [PATCH] Applets: Use spawn_or_show_error() for common spawn pattern --- Userland/Applets/Network/main.cpp | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/Userland/Applets/Network/main.cpp b/Userland/Applets/Network/main.cpp index f0e5d77bcd..51d2b53bba 100644 --- a/Userland/Applets/Network/main.cpp +++ b/Userland/Applets/Network/main.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -49,17 +50,7 @@ private: { if (event.button() != GUI::MouseButton::Primary) return; - - pid_t child_pid; - char const* argv[] = { "SystemMonitor", "-t", "network", nullptr }; - - if ((errno = posix_spawn(&child_pid, "/bin/SystemMonitor", nullptr, nullptr, const_cast(argv), environ))) { - perror("posix_spawn"); - return; - } - - if (disown(child_pid) < 0) - perror("disown"); + GUI::Process::spawn_or_show_error(window(), "/bin/SystemMonitor", Array { "-t", "network" }); } virtual void update_widget()