mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 15:40:19 +00:00
Applets: Use spawn_or_show_error() for common spawn pattern
This commit is contained in:
parent
5fd5a03d1f
commit
5aad6a4378
Notes:
sideshowbarker
2024-07-17 10:29:09 +09:00
Author: https://github.com/MacDue Commit: https://github.com/SerenityOS/serenity/commit/5aad6a4378 Pull-request: https://github.com/SerenityOS/serenity/pull/14109 Reviewed-by: https://github.com/linusg
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…
Reference in a new issue