Index: runtime/bin/process_macos.cc |
diff --git a/runtime/bin/process_macos.cc b/runtime/bin/process_macos.cc |
index b7bb9b0ba7f1ccadf9f4e0cb187098472af40b22..15b37672e51305875cedc58202fc40dcf17ceaed 100644 |
--- a/runtime/bin/process_macos.cc |
+++ b/runtime/bin/process_macos.cc |
@@ -7,6 +7,7 @@ |
#include "bin/process.h" |
+#include <crt_externs.h> // NOLINT |
#include <errno.h> // NOLINT |
#include <fcntl.h> // NOLINT |
#include <poll.h> // NOLINT |
@@ -24,8 +25,6 @@ |
#include "platform/signal_blocker.h" |
-extern char **environ; |
- |
namespace dart { |
namespace bin { |
@@ -456,7 +455,10 @@ class ProcessStarter { |
} |
if (program_environment_ != NULL) { |
- environ = program_environment_; |
+ // On MacOS you have to do a bit of magic to get to the |
+ // environment strings. |
+ char*** environ = _NSGetEnviron(); |
+ *environ = program_environment; |
} |
VOID_TEMP_FAILURE_RETRY( |