mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
SystemMenu: Disown child processes after spawning
This commit is contained in:
@@ -215,7 +215,12 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
|
||||
system_menu->add_action(GUI::Action::create("About...", Gfx::Bitmap::load_from_file("/res/icons/16x16/ladybug.png"), [](auto&) {
|
||||
pid_t child_pid;
|
||||
const char* argv[] = { "/bin/About", nullptr };
|
||||
posix_spawn(&child_pid, "/bin/About", nullptr, nullptr, const_cast<char**>(argv), environ);
|
||||
if ((errno = posix_spawn(&child_pid, "/bin/About", nullptr, nullptr, const_cast<char**>(argv), environ))) {
|
||||
perror("posix_spawn");
|
||||
} else {
|
||||
if (disown(child_pid) < 0)
|
||||
perror("disown");
|
||||
}
|
||||
}));
|
||||
system_menu->add_separator();
|
||||
system_menu->add_action(GUI::Action::create("Exit...", Gfx::Bitmap::load_from_file("/res/icons/16x16/power.png"), [](auto&) {
|
||||
@@ -225,7 +230,12 @@ NonnullRefPtr<GUI::Menu> build_system_menu()
|
||||
return;
|
||||
|
||||
pid_t child_pid;
|
||||
posix_spawn(&child_pid, command[0], nullptr, nullptr, const_cast<char**>(command.data()), environ);
|
||||
if ((errno = posix_spawn(&child_pid, command[0], nullptr, nullptr, const_cast<char**>(command.data()), environ))) {
|
||||
perror("posix_spawn");
|
||||
} else {
|
||||
if (disown(child_pid) < 0)
|
||||
perror("disown");
|
||||
}
|
||||
}));
|
||||
|
||||
return system_menu;
|
||||
|
||||
Reference in New Issue
Block a user