commit 05e608a0c72a5da8cc92a50dd6f79bad046fb977 (tree)
parent e29a3b1d2a74732c6e6e4a1f10a02b45797fe4e2
Author: Andrew Kelley <superjoe30@gmail.com>
Date: Tue, 9 Oct 2018 12:58:13 -0400
stage1 os: workaround for macos not having environ variable
Diffstat:
1 file changed, 6 insertions(+), 0 deletions(-)
diff --git a/src/os.cpp b/src/os.cpp
@@ -71,6 +71,12 @@ static clock_serv_t cclock;
#include <errno.h>
#include <time.h>
+// Apple doesn't provide the environ global variable
+#if defined(__APPLE__) && !defined(environ)
+#include <crt_externs.h>
+#define environ (*_NSGetEnviron())
+#endif
+
#if defined(ZIG_OS_POSIX)
static void populate_termination(Termination *term, int status) {
if (WIFEXITED(status)) {