From 139fa396e8fa0e8603d4f53ac90841421e50aa3f Mon Sep 17 00:00:00 2001 From: alaviss Date: Mon, 7 Jan 2019 18:27:07 +0700 Subject: 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. --- lib/pure/os.nim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib/pure') 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) -- cgit 1.4.1-2-gfad0