File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change 20
20
21
21
#include < queue>
22
22
23
+ extern char ** environ __attribute__ ((weak));
24
+
23
25
namespace nix ::fs { using namespace std ::filesystem; }
24
26
25
27
using namespace nix ;
@@ -88,9 +90,11 @@ void execProgramInStore(ref<Store> store,
88
90
linux::setPersonality (*system);
89
91
#endif
90
92
91
- if (useLookupPath == UseLookupPath::Use)
92
- execvpe (program.c_str (), stringsToCharPtrs (args).data (), envp);
93
- else
93
+ if (useLookupPath == UseLookupPath::Use) {
94
+ // We have to set `environ` by hand because there is no `execvpe` on macOS.
95
+ environ = envp;
96
+ execvp (program.c_str (), stringsToCharPtrs (args).data ());
97
+ } else
94
98
execve (program.c_str (), stringsToCharPtrs (args).data (), envp);
95
99
96
100
throw SysError (" unable to execute '%s'" , program);
You can’t perform that action at this time.
0 commit comments