mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 03:17:34 +00:00
Ladybird/WebDriver: Retrieve process environment in an OS-dependent way
This commit is contained in:
parent
e5192073d9
commit
03294b0177
1 changed files with 17 additions and 2 deletions
|
@ -7,6 +7,7 @@
|
||||||
#define AK_DONT_REPLACE_STD
|
#define AK_DONT_REPLACE_STD
|
||||||
|
|
||||||
#include "../Utilities.h"
|
#include "../Utilities.h"
|
||||||
|
#include <AK/Platform.h>
|
||||||
#include <LibCore/ArgsParser.h>
|
#include <LibCore/ArgsParser.h>
|
||||||
#include <LibCore/Directory.h>
|
#include <LibCore/Directory.h>
|
||||||
#include <LibCore/EventLoop.h>
|
#include <LibCore/EventLoop.h>
|
||||||
|
@ -16,8 +17,22 @@
|
||||||
#include <LibMain/Main.h>
|
#include <LibMain/Main.h>
|
||||||
#include <WebDriver/Client.h>
|
#include <WebDriver/Client.h>
|
||||||
|
|
||||||
|
#if defined(AK_OS_MACOS)
|
||||||
|
# include <crt_externs.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
extern DeprecatedString s_serenity_resource_root;
|
extern DeprecatedString s_serenity_resource_root;
|
||||||
|
|
||||||
|
static char** environment()
|
||||||
|
{
|
||||||
|
#if defined(AK_OS_MACOS)
|
||||||
|
return *_NSGetEnviron();
|
||||||
|
#else
|
||||||
|
extern char** environ;
|
||||||
|
return environ;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
static ErrorOr<pid_t> launch_browser(DeprecatedString const& socket_path)
|
static ErrorOr<pid_t> launch_browser(DeprecatedString const& socket_path)
|
||||||
{
|
{
|
||||||
char const* argv[] = {
|
char const* argv[] = {
|
||||||
|
@ -27,7 +42,7 @@ static ErrorOr<pid_t> launch_browser(DeprecatedString const& socket_path)
|
||||||
nullptr,
|
nullptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
return Core::System::posix_spawn("./ladybird"sv, nullptr, nullptr, const_cast<char**>(argv), environ);
|
return Core::System::posix_spawn("./ladybird"sv, nullptr, nullptr, const_cast<char**>(argv), environment());
|
||||||
}
|
}
|
||||||
|
|
||||||
static ErrorOr<pid_t> launch_headless_browser(DeprecatedString const& socket_path)
|
static ErrorOr<pid_t> launch_headless_browser(DeprecatedString const& socket_path)
|
||||||
|
@ -50,7 +65,7 @@ static ErrorOr<pid_t> launch_headless_browser(DeprecatedString const& socket_pat
|
||||||
nullptr,
|
nullptr,
|
||||||
};
|
};
|
||||||
|
|
||||||
return Core::System::posix_spawn("./_deps/lagom-build/headless-browser"sv, nullptr, nullptr, const_cast<char**>(argv), environ);
|
return Core::System::posix_spawn("./_deps/lagom-build/headless-browser"sv, nullptr, nullptr, const_cast<char**>(argv), environment());
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
ErrorOr<int> serenity_main(Main::Arguments arguments)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue