mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-18 13:30:33 +00:00
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:
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user