diff --git a/Ladybird/WebDriver/main.cpp b/Ladybird/WebDriver/main.cpp index 96c62daacdb..9cd3946e742 100644 --- a/Ladybird/WebDriver/main.cpp +++ b/Ladybird/WebDriver/main.cpp @@ -7,6 +7,7 @@ #define AK_DONT_REPLACE_STD #include "../Utilities.h" +#include #include #include #include @@ -16,8 +17,22 @@ #include #include +#if defined(AK_OS_MACOS) +# include +#endif + 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 launch_browser(DeprecatedString const& socket_path) { char const* argv[] = { @@ -27,7 +42,7 @@ static ErrorOr launch_browser(DeprecatedString const& socket_path) nullptr, }; - return Core::System::posix_spawn("./ladybird"sv, nullptr, nullptr, const_cast(argv), environ); + return Core::System::posix_spawn("./ladybird"sv, nullptr, nullptr, const_cast(argv), environment()); } static ErrorOr launch_headless_browser(DeprecatedString const& socket_path) @@ -50,7 +65,7 @@ static ErrorOr launch_headless_browser(DeprecatedString const& socket_pat nullptr, }; - return Core::System::posix_spawn("./_deps/lagom-build/headless-browser"sv, nullptr, nullptr, const_cast(argv), environ); + return Core::System::posix_spawn("./_deps/lagom-build/headless-browser"sv, nullptr, nullptr, const_cast(argv), environment()); } ErrorOr serenity_main(Main::Arguments arguments)