mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:17:45 +00:00
SystemMenu: Disown spawned programs
This commit is contained in:
parent
7de831efc6
commit
7219f069a5
1 changed files with 6 additions and 1 deletions
|
@ -36,6 +36,7 @@
|
||||||
#include <LibGUI/Menu.h>
|
#include <LibGUI/Menu.h>
|
||||||
#include <LibGUI/WindowServerConnection.h>
|
#include <LibGUI/WindowServerConnection.h>
|
||||||
#include <LibGfx/Bitmap.h>
|
#include <LibGfx/Bitmap.h>
|
||||||
|
#include <serenity.h>
|
||||||
#include <spawn.h>
|
#include <spawn.h>
|
||||||
|
|
||||||
//#define SYSTEM_MENU_DEBUG
|
//#define SYSTEM_MENU_DEBUG
|
||||||
|
@ -163,8 +164,12 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
|
||||||
const auto& bin = g_apps[app_identifier].executable;
|
const auto& bin = g_apps[app_identifier].executable;
|
||||||
pid_t child_pid;
|
pid_t child_pid;
|
||||||
const char* argv[] = { bin.characters(), nullptr };
|
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");
|
perror("posix_spawn");
|
||||||
|
} else {
|
||||||
|
if (disown(child_pid) < 0)
|
||||||
|
perror("disown");
|
||||||
|
}
|
||||||
}));
|
}));
|
||||||
++app_identifier;
|
++app_identifier;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue