1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:47:35 +00:00

Ladybird: Foward the WebContent passing socket FD by command line

Rather than needing to set another environment variable for WebDriver's
passing socket, let's forward these FDs by command line. This also moves
the creation of the WebContent connection to a helper function so that
the WebDriver connection can re-use it.
This commit is contained in:
Timothy Flynn 2022-11-14 08:13:37 -05:00 committed by Andrew Kaster
parent 39954f9e7f
commit 7021d30288
2 changed files with 48 additions and 28 deletions

View file

@ -589,14 +589,20 @@ void WebContentView::create_client()
auto takeover_string = String::formatted("WebContent:{}", wc_fd);
MUST(Core::System::setenv("SOCKET_TAKEOVER"sv, takeover_string, true));
auto fd_passing_socket_string = String::formatted("{}", wc_fd_passing_fd);
MUST(Core::System::setenv("FD_PASSING_SOCKET"sv, fd_passing_socket_string, true));
auto fd_passing_socket_string = String::number(wc_fd_passing_fd);
auto rc = execlp("./WebContent/WebContent", "WebContent", nullptr);
char const* argv[] = {
"WebContent",
"--webcontent-fd-passing-socket",
fd_passing_socket_string.characters(),
nullptr,
};
auto rc = execvp("./WebContent/WebContent", const_cast<char**>(argv));
if (rc < 0)
rc = execlp((QCoreApplication::applicationDirPath() + "/WebContent").toStdString().c_str(), "WebContent", nullptr);
rc = execvp((QCoreApplication::applicationDirPath() + "/WebContent").toStdString().c_str(), const_cast<char**>(argv));
if (rc < 0)
perror("execlp");
perror("execvp");
VERIFY_NOT_REACHED();
}