1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:17:44 +00:00

Clock.MenuApplet: Disown child process after spawning

This commit is contained in:
Andreas Kling 2020-08-04 14:25:03 +02:00
parent 6e1cb2bae8
commit 9e81b93ab9

View file

@ -31,6 +31,7 @@
#include <LibGUI/Window.h> #include <LibGUI/Window.h>
#include <LibGfx/Font.h> #include <LibGfx/Font.h>
#include <LibGfx/Palette.h> #include <LibGfx/Palette.h>
#include <serenity.h>
#include <spawn.h> #include <spawn.h>
#include <stdio.h> #include <stdio.h>
#include <time.h> #include <time.h>
@ -52,7 +53,7 @@ public:
}); });
} }
virtual ~ClockWidget() override {} virtual ~ClockWidget() override { }
int get_width() int get_width()
{ {
@ -87,8 +88,12 @@ private:
pid_t pid; pid_t pid;
const char* argv[] = { "Calendar", nullptr }; const char* argv[] = { "Calendar", nullptr };
if ((errno = posix_spawn(&pid, "/bin/Calendar", nullptr, nullptr, const_cast<char**>(argv), environ))) if ((errno = posix_spawn(&pid, "/bin/Calendar", nullptr, nullptr, const_cast<char**>(argv), environ))) {
perror("posix_spawn"); perror("posix_spawn");
} else {
if (disown(pid) < 0)
perror("disown");
}
} }
void tick_clock() void tick_clock()