From 256ad7b1228acaf3b4653ffb13911e1d3f683c19 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 4 Aug 2020 14:23:18 +0200 Subject: [PATCH] SystemMonitor: Disown child processes after spawning --- Applications/SystemMonitor/main.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Applications/SystemMonitor/main.cpp b/Applications/SystemMonitor/main.cpp index 1525e575ec..f644477927 100644 --- a/Applications/SystemMonitor/main.cpp +++ b/Applications/SystemMonitor/main.cpp @@ -55,6 +55,7 @@ #include #include #include +#include #include #include #include @@ -222,6 +223,9 @@ int main(int argc, char** argv) const char* argv[] = { "/bin/Profiler", "--pid", pid_string.characters(), nullptr }; if ((errno = posix_spawn(&child, "/bin/Profiler", nullptr, nullptr, const_cast(argv), environ))) { perror("posix_spawn"); + } else { + if (disown(child) < 0) + perror("disown"); } } }); @@ -235,6 +239,9 @@ int main(int argc, char** argv) const char* argv[] = { "/bin/Inspector", pid_string.characters(), nullptr }; if ((errno = posix_spawn(&child, "/bin/Inspector", nullptr, nullptr, const_cast(argv), environ))) { perror("posix_spawn"); + } else { + if (disown(child) < 0) + perror("disown"); } } });