From 78def34c5e721ccacbfa19f5eeb27405da50dc23 Mon Sep 17 00:00:00 2001 From: Timothy Flynn Date: Sun, 29 Jan 2023 09:43:14 -0500 Subject: [PATCH] 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. --- Userland/Libraries/LibSQL/SQLClient.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 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));