1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 01:17:34 +00:00

WebDriver: Use Core::Process::spawn() to launch browsers

This commit is contained in:
MacDue 2023-03-13 20:31:29 +00:00 committed by Linus Groh
parent 2aa8c9950e
commit ceffca9a75

View file

@ -7,6 +7,7 @@
#include <LibCore/ArgsParser.h> #include <LibCore/ArgsParser.h>
#include <LibCore/Directory.h> #include <LibCore/Directory.h>
#include <LibCore/EventLoop.h> #include <LibCore/EventLoop.h>
#include <LibCore/Process.h>
#include <LibCore/StandardPaths.h> #include <LibCore/StandardPaths.h>
#include <LibCore/System.h> #include <LibCore/System.h>
#include <LibCore/TCPServer.h> #include <LibCore/TCPServer.h>
@ -15,27 +16,21 @@
static ErrorOr<pid_t> launch_browser(DeprecatedString const& socket_path) static ErrorOr<pid_t> launch_browser(DeprecatedString const& socket_path)
{ {
char const* argv[] = { return Core::Process::spawn("/bin/Browser"sv,
"/bin/Browser", Array {
"--webdriver-content-path", "--webdriver-content-path",
socket_path.characters(), socket_path.characters(),
nullptr, });
};
return Core::System::posix_spawn("/bin/Browser"sv, nullptr, nullptr, const_cast<char**>(argv), environ);
} }
static ErrorOr<pid_t> launch_headless_browser(DeprecatedString const& socket_path) static ErrorOr<pid_t> launch_headless_browser(DeprecatedString const& socket_path)
{ {
char const* argv[] = { return Core::Process::spawn("/bin/headless-browser"sv,
"/bin/headless-browser", Array {
"--webdriver-ipc-path", "--webdriver-ipc-path",
socket_path.characters(), socket_path.characters(),
"about:blank", "about:blank",
nullptr, });
};
return Core::System::posix_spawn("/bin/headless-browser"sv, nullptr, nullptr, const_cast<char**>(argv), environ);
} }
ErrorOr<int> serenity_main(Main::Arguments arguments) ErrorOr<int> serenity_main(Main::Arguments arguments)