mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-02 20:40:29 +00:00
SystemMenu: Disown child processes after spawning
This commit is contained in:
parent
cf624550e5
commit
6e1cb2bae8
Notes:
sideshowbarker
2024-07-19 04:19:11 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/6e1cb2bae88
1 changed files with 12 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue