aboutsummaryrefslogtreecommitdiffstats
path: root/lib/System
diff options
context:
space:
mode:
Diffstat (limited to 'lib/System')
-rw-r--r--lib/System/Unix/Program.inc7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/System/Unix/Program.inc b/lib/System/Unix/Program.inc
index 7fdf387..b7b4e9e 100644
--- a/lib/System/Unix/Program.inc
+++ b/lib/System/Unix/Program.inc
@@ -34,6 +34,8 @@
#include <spawn.h>
#if !defined(__APPLE__)
extern char **environ;
+#else
+#include <crt_externs.h> // _NSGetEnviron
#endif
#endif
@@ -202,8 +204,11 @@ Program::Execute(const Path &path, const char **args, const char **envp,
}
}
+ if (!envp)
#if !defined(__APPLE__)
- if (!envp) envp = (const char**)environ;
+ envp = (const char**)environ;
+#else
+ envp = (const char**)*_NSGetEnviron(); // environ is missing in dylibs.
#endif
pid_t PID;