osproc: MacOSX workaround for lack of execvpe
This commit is contained in:
parent
00b69192f2
commit
30a3098095
1 changed files with 10 additions and 1 deletions
|
|
@ -779,6 +779,9 @@ elif not defined(useNimRtl):
|
||||||
discard write(data.pErrorPipe[writeIdx], addr error, sizeof(error))
|
discard write(data.pErrorPipe[writeIdx], addr error, sizeof(error))
|
||||||
exitnow(1)
|
exitnow(1)
|
||||||
|
|
||||||
|
when defined(macosx):
|
||||||
|
var environ {.importc.}: cstringArray
|
||||||
|
|
||||||
proc startProcessAfterFork(data: ptr TStartProcessData) =
|
proc startProcessAfterFork(data: ptr TStartProcessData) =
|
||||||
# Warning: no GC here!
|
# Warning: no GC here!
|
||||||
# Or anythink that touches global structures - all called nimrod procs
|
# Or anythink that touches global structures - all called nimrod procs
|
||||||
|
|
@ -806,6 +809,12 @@ elif not defined(useNimRtl):
|
||||||
discard fcntl(data.pErrorPipe[writeIdx], F_SETFD, FD_CLOEXEC)
|
discard fcntl(data.pErrorPipe[writeIdx], F_SETFD, FD_CLOEXEC)
|
||||||
|
|
||||||
if data.optionPoUsePath:
|
if data.optionPoUsePath:
|
||||||
|
when defined(macosx):
|
||||||
|
# MacOSX doesn't have execvpe, so we need workaround.
|
||||||
|
# On MacOSX we can arrive here only from fork, so this is safe:
|
||||||
|
environ = data.sysEnv
|
||||||
|
discard execvp(data.sysCommand, data.sysArgs)
|
||||||
|
else:
|
||||||
discard execvpe(data.sysCommand, data.sysArgs, data.sysEnv)
|
discard execvpe(data.sysCommand, data.sysArgs, data.sysEnv)
|
||||||
else:
|
else:
|
||||||
discard execve(data.sysCommand, data.sysArgs, data.sysEnv)
|
discard execve(data.sysCommand, data.sysArgs, data.sysEnv)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue