Only use execvpe on linux, execvp elsewhere (fixes #3759)
This commit is contained in:
parent
4e0f8cf595
commit
4246f660ea
1 changed files with 7 additions and 8 deletions
|
|
@ -886,7 +886,7 @@ 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) or defined(freebsd) or defined(netbsd) or defined(android):
|
when not defined(uClibc) and (not defined(linux) or defined(android)):
|
||||||
var environ {.importc.}: cstringArray
|
var environ {.importc.}: cstringArray
|
||||||
|
|
||||||
proc startProcessAfterFork(data: ptr StartProcessData) =
|
proc startProcessAfterFork(data: ptr StartProcessData) =
|
||||||
|
|
@ -916,17 +916,16 @@ 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) or defined(freebsd) or defined(netbsd) or defined(android):
|
when defined(uClibc):
|
||||||
|
# uClibc environment (OpenWrt included) doesn't have the full execvpe
|
||||||
|
discard execve(data.sysCommand, data.sysArgs, data.sysEnv)
|
||||||
|
elif defined(linux) and not defined(android):
|
||||||
|
discard execvpe(data.sysCommand, data.sysArgs, data.sysEnv)
|
||||||
|
else:
|
||||||
# MacOSX doesn't have execvpe, so we need workaround.
|
# MacOSX doesn't have execvpe, so we need workaround.
|
||||||
# On MacOSX we can arrive here only from fork, so this is safe:
|
# On MacOSX we can arrive here only from fork, so this is safe:
|
||||||
environ = data.sysEnv
|
environ = data.sysEnv
|
||||||
discard execvp(data.sysCommand, data.sysArgs)
|
discard execvp(data.sysCommand, data.sysArgs)
|
||||||
else:
|
|
||||||
when defined(uClibc):
|
|
||||||
# uClibc environment (OpenWrt included) doesn't have the full execvpe
|
|
||||||
discard execve(data.sysCommand, data.sysArgs, data.sysEnv)
|
|
||||||
else:
|
|
||||||
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