mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:07:35 +00:00
Applets: Use spawn_or_show_error() for common spawn pattern
This commit is contained in:
parent
5fd5a03d1f
commit
5aad6a4378
1 changed files with 2 additions and 11 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <LibGUI/ImageWidget.h>
|
||||
#include <LibGUI/Menu.h>
|
||||
#include <LibGUI/Notification.h>
|
||||
#include <LibGUI/Process.h>
|
||||
#include <LibGUI/Window.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibMain/Main.h>
|
||||
|
@ -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<char**>(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()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue