summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authoralaviss <alaviss@users.noreply.github.com>2019-01-08 18:41:15 +0700
committerAndreas Rumpf <rumpf_a@web.de>2019-01-08 12:41:15 +0100
commit6737634d88a70a3d87774c9f51f2ac6d2bf4da4f (patch)
tree695c837a0cae6f6344635bc91216aa5a61c0c380 /lib/pure
parent821920aa391c1361ee17befedf4452edba47c87c (diff)
downloadNim-6737634d88a70a3d87774c9f51f2ac6d2bf4da4f.tar.gz
os.execShellCmd: fixes #10231 (#10232)
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.
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/os.nim4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index a218121ed..3a959d4e2 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -1297,7 +1297,9 @@ proc execShellCmd*(command: string): int {.rtl, extern: "nos$1",
   ## the process has finished. To execute a program without having a
   ## shell involved, use the `execProcess` proc of the `osproc`
   ## module.
-  when defined(posix):
+  when defined(macosx):
+    result = c_system(command) shr 8
+  elif defined(posix):
     result = WEXITSTATUS(c_system(command))
   else:
     result = c_system(command)