summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibSQL
diff options
context:
space:
mode:
authorTimothy Flynn <trflynn89@pm.me>2023-01-29 09:43:14 -0500
committerLinus Groh <mail@linusgroh.de>2023-01-29 18:32:21 +0000
commit78def34c5e721ccacbfa19f5eeb27405da50dc23 (patch)
treebe85a749079978ab876208fc651952be4a98432f /Userland/Libraries/LibSQL
parent4b8bae81516539b9c8a2d8eafe7eeb2a6e038b80 (diff)
downloadserenity-78def34c5e721ccacbfa19f5eeb27405da50dc23.zip
LibSQL: Use `kill` to exit forked SQLServer processes to avoid Qt issues
In order to daemonize the SQLServer process for Ladybird, we double-fork and exit the first child process to ensure the grandchild process is in a detached state to become SQLServer. After commit c05fcd5, this happens after Ladybird's QApplication is created. QApplication seems to hook up some `exit` handling that makes the call to `exit(0)` here not actually exit the child process. Instead, using `kill` with SIGTERM will actually terminate the child process.
Diffstat (limited to 'Userland/Libraries/LibSQL')
-rw-r--r--Userland/Libraries/LibSQL/SQLClient.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/Userland/Libraries/LibSQL/SQLClient.cpp b/Userland/Libraries/LibSQL/SQLClient.cpp
index ab57af151d..506b972895 100644
--- a/Userland/Libraries/LibSQL/SQLClient.cpp
+++ b/Userland/Libraries/LibSQL/SQLClient.cpp
@@ -69,7 +69,7 @@ static ErrorOr<void> launch_server(DeprecatedString const& socket_path, Deprecat
auto server_pid_file = TRY(Core::Stream::File::open(pid_path, Core::Stream::OpenMode::Write));
TRY(server_pid_file->write(DeprecatedString::number(server_pid).bytes()));
- exit(0);
+ TRY(Core::System::kill(getpid(), SIGTERM));
}
server_fd = TRY(Core::System::dup(server_fd));