From 7219f069a5335bfcf141047e9483306c0a2e3d1b Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 4 Aug 2020 13:53:19 +0200 Subject: [PATCH] SystemMenu: Disown spawned programs --- Services/SystemMenu/main.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Services/SystemMenu/main.cpp b/Services/SystemMenu/main.cpp index 1b7554c2e5..8a6ad8aa75 100644 --- a/Services/SystemMenu/main.cpp +++ b/Services/SystemMenu/main.cpp @@ -36,6 +36,7 @@ #include #include #include +#include #include //#define SYSTEM_MENU_DEBUG @@ -163,8 +164,12 @@ NonnullRefPtr build_system_menu() const auto& bin = g_apps[app_identifier].executable; pid_t child_pid; const char* argv[] = { bin.characters(), nullptr }; - if ((errno = posix_spawn(&child_pid, bin.characters(), nullptr, nullptr, const_cast(argv), environ))) + if ((errno = posix_spawn(&child_pid, bin.characters(), nullptr, nullptr, const_cast(argv), environ))) { perror("posix_spawn"); + } else { + if (disown(child_pid) < 0) + perror("disown"); + } })); ++app_identifier; }