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.
This commit is contained in:
alaviss 2019-01-07 18:27:07 +07:00 • committed by Andreas Rumpf
commit 139fa396e8

View file

@ -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)