summary refs log tree commit diff stats
path: root/lib/pure
diff options
context:
space:
mode:
authoralaviss <alaviss@users.noreply.github.com>2019-01-07 18:27:07 +0700
committerAndreas Rumpf <rumpf_a@web.de>2019-01-07 12:27:07 +0100
commit139fa396e8fa0e8603d4f53ac90841421e50aa3f (patch)
tree8b6640bd50e9f5b6826f6e0fd5a6160798dadd35 /lib/pure
parent87f8ec5b92d5647ab4b1875262e845d51dd82763 (diff)
downloadNim-139fa396e8fa0e8603d4f53ac90841421e50aa3f.tar.gz
os.execShellCmd: use WEXITSTATUS to retrieve exit code (#10222)
According to POSIX, system() shall returns the termination status in the
format specified by waitpid(), which means WEXITSTATUS should be used to
retrieve the exit code portably.

This fixes execShellCmd on Haiku.
Diffstat (limited to 'lib/pure')
-rw-r--r--lib/pure/os.nim2
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/pure/os.nim b/lib/pure/os.nim
index 96833056a..a218121ed 100644
--- a/lib/pure/os.nim
+++ b/lib/pure/os.nim
@@ -1298,7 +1298,7 @@ proc execShellCmd*(command: string): int {.rtl, extern: "nos$1",
   ## shell involved, use the `execProcess` proc of the `osproc`
   ## module.
   when defined(posix):
-    result = c_system(command) shr 8
+    result = WEXITSTATUS(c_system(command))
   else:
     result = c_system(command)