Darwin has long deprecated the wait union, but their macros still assume it unless you define _POSIX_C_SOURCE. This trips up C++ compilers. This commit duplicates the behavior of WEXITSTATUS when _POSIX_C_SOURCE is defined.
This commit is contained in:
parent
821920aa39
commit
6737634d88
2 changed files with 16 additions and 1 deletions
|
|
@ -1297,7 +1297,9 @@ proc execShellCmd*(command: string): int {.rtl, extern: "nos$1",
|
||||||
## the process has finished. To execute a program without having a
|
## the process has finished. To execute a program without having a
|
||||||
## shell involved, use the `execProcess` proc of the `osproc`
|
## shell involved, use the `execProcess` proc of the `osproc`
|
||||||
## module.
|
## module.
|
||||||
when defined(posix):
|
when defined(macosx):
|
||||||
|
result = c_system(command) shr 8
|
||||||
|
elif defined(posix):
|
||||||
result = WEXITSTATUS(c_system(command))
|
result = WEXITSTATUS(c_system(command))
|
||||||
else:
|
else:
|
||||||
result = c_system(command)
|
result = c_system(command)
|
||||||
|
|
|
||||||
13
tests/stdlib/t10231.nim
Normal file
13
tests/stdlib/t10231.nim
Normal file
|
|
@ -0,0 +1,13 @@
|
||||||
|
discard """
|
||||||
|
target: cpp
|
||||||
|
action: run
|
||||||
|
exitcode: 0
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
if paramCount() == 0:
|
||||||
|
# main process
|
||||||
|
doAssert execShellCmd(getAppFilename().quoteShell & " test") == 1
|
||||||
|
else:
|
||||||
|
quit 1
|
||||||
Loading…
Add table
Add a link
Reference in a new issue