summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--lib/pure/os.nim4
-rw-r--r--tests/stdlib/t10231.nim13
2 files changed, 16 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)
diff --git a/tests/stdlib/t10231.nim b/tests/stdlib/t10231.nim
new file mode 100644
index 000000000..5d1101aa4
--- /dev/null
+++ b/tests/stdlib/t10231.nim
@@ -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