mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:07:36 +00:00
LaunchServer: Disown child processes after spawning
This commit is contained in:
parent
8cf818e7c7
commit
cb1fcd3eaf
1 changed files with 15 additions and 11 deletions
|
@ -33,6 +33,7 @@
|
||||||
#include <AK/StringBuilder.h>
|
#include <AK/StringBuilder.h>
|
||||||
#include <LibCore/ConfigFile.h>
|
#include <LibCore/ConfigFile.h>
|
||||||
#include <LibCore/DirIterator.h>
|
#include <LibCore/DirIterator.h>
|
||||||
|
#include <serenity.h>
|
||||||
#include <spawn.h>
|
#include <spawn.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
@ -66,17 +67,17 @@ String Handler::to_details_str() const
|
||||||
obj.add("executable", executable);
|
obj.add("executable", executable);
|
||||||
obj.add("name", name);
|
obj.add("name", name);
|
||||||
switch (handler_type) {
|
switch (handler_type) {
|
||||||
case Type::Application:
|
case Type::Application:
|
||||||
obj.add("type", "app");
|
obj.add("type", "app");
|
||||||
break;
|
break;
|
||||||
case Type::UserDefault:
|
case Type::UserDefault:
|
||||||
obj.add("type", "userdefault");
|
obj.add("type", "userdefault");
|
||||||
break;
|
break;
|
||||||
case Type::UserPreferred:
|
case Type::UserPreferred:
|
||||||
obj.add("type", "userpreferred");
|
obj.add("type", "userpreferred");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!icons.is_empty()) {
|
if (!icons.is_empty()) {
|
||||||
JsonObject icons_obj;
|
JsonObject icons_obj;
|
||||||
|
@ -220,6 +221,9 @@ bool spawn(String executable, String argument)
|
||||||
if ((errno = posix_spawn(&child_pid, executable.characters(), nullptr, nullptr, const_cast<char**>(argv), environ))) {
|
if ((errno = posix_spawn(&child_pid, executable.characters(), nullptr, nullptr, const_cast<char**>(argv), environ))) {
|
||||||
perror("posix_spawn");
|
perror("posix_spawn");
|
||||||
return false;
|
return false;
|
||||||
|
} else {
|
||||||
|
if (disown(child_pid) < 0)
|
||||||
|
perror("disown");
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue