1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 16:15:10 +00:00

ResourceGraph.MenuApplet: Disown child processes after spawning

This commit is contained in:
Andreas Kling 2020-08-04 14:25:27 +02:00
parent 9e81b93ab9
commit 8cf818e7c7

View file

@ -35,6 +35,7 @@
#include <LibGUI/Painter.h> #include <LibGUI/Painter.h>
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibGfx/Palette.h> #include <LibGfx/Palette.h>
#include <serenity.h>
#include <spawn.h> #include <spawn.h>
#include <stdio.h> #include <stdio.h>
@ -109,8 +110,12 @@ private:
return; return;
pid_t child_pid; pid_t child_pid;
const char* argv[] = { "SystemMonitor", nullptr }; const char* argv[] = { "SystemMonitor", nullptr };
if ((errno = posix_spawn(&child_pid, "/bin/SystemMonitor", nullptr, nullptr, const_cast<char**>(argv), environ))) if ((errno = posix_spawn(&child_pid, "/bin/SystemMonitor", nullptr, nullptr, const_cast<char**>(argv), environ))) {
perror("posix_spawn"); perror("posix_spawn");
} else {
if (disown(child_pid) < 0)
perror("disown");
}
} }
static void get_cpu_usage(unsigned& busy, unsigned& idle) static void get_cpu_usage(unsigned& busy, unsigned& idle)