7
7
#define AK_DONT_REPLACE_STD
8
8
9
9
#include " ../Utilities.h"
10
+ #include < AK/Platform.h>
10
11
#include < LibCore/ArgsParser.h>
11
12
#include < LibCore/Directory.h>
12
13
#include < LibCore/EventLoop.h>
16
17
#include < LibMain/Main.h>
17
18
#include < WebDriver/Client.h>
18
19
20
+ #if defined(AK_OS_MACOS)
21
+ # include < crt_externs.h>
22
+ #endif
23
+
19
24
extern DeprecatedString s_serenity_resource_root;
20
25
26
+ static char ** environment ()
27
+ {
28
+ #if defined(AK_OS_MACOS)
29
+ return *_NSGetEnviron ();
30
+ #else
31
+ extern char ** environ;
32
+ return environ;
33
+ #endif
34
+ }
35
+
21
36
static ErrorOr<pid_t > launch_browser (DeprecatedString const & socket_path)
22
37
{
23
38
char const * argv[] = {
@@ -27,7 +42,7 @@ static ErrorOr<pid_t> launch_browser(DeprecatedString const& socket_path)
27
42
nullptr ,
28
43
};
29
44
30
- return Core::System::posix_spawn (" ./ladybird" sv, nullptr , nullptr , const_cast <char **>(argv), environ );
45
+ return Core::System::posix_spawn (" ./ladybird" sv, nullptr , nullptr , const_cast <char **>(argv), environment () );
31
46
}
32
47
33
48
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
50
65
nullptr ,
51
66
};
52
67
53
- return Core::System::posix_spawn (" ./_deps/lagom-build/headless-browser" sv, nullptr , nullptr , const_cast <char **>(argv), environ );
68
+ return Core::System::posix_spawn (" ./_deps/lagom-build/headless-browser" sv, nullptr , nullptr , const_cast <char **>(argv), environment () );
54
69
}
55
70
56
71
ErrorOr<int > serenity_main (Main::Arguments arguments)
0 commit comments