summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2020-08-04 13:53:19 +0200
committerAndreas Kling <kling@serenityos.org>2020-08-04 18:17:16 +0200
commit7219f069a5335bfcf141047e9483306c0a2e3d1b (patch)
treed4e3a8ddff7a1d5d763c69ef4be771c64dde648b
parent7de831efc65993c44c9e87342a08f6a122250794 (diff)
downloadserenity-7219f069a5335bfcf141047e9483306c0a2e3d1b.zip
SystemMenu: Disown spawned programs
-rw-r--r--Services/SystemMenu/main.cpp7
1 files changed, 6 insertions, 1 deletions
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 <LibGUI/Menu.h>
#include <LibGUI/WindowServerConnection.h>
#include <LibGfx/Bitmap.h>
+#include <serenity.h>
#include <spawn.h>
//#define SYSTEM_MENU_DEBUG
@@ -163,8 +164,12 @@ NonnullRefPtr<GUI::Menu> 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<char**>(argv), environ)))
+ if ((errno = posix_spawn(&child_pid, bin.characters(), nullptr, nullptr, const_cast<char**>(argv), environ))) {
perror("posix_spawn");
+ } else {
+ if (disown(child_pid) < 0)
+ perror("disown");
+ }
}));
++app_identifier;
}