X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=common%2Fos_posix.cpp;h=7d39d8ada5e0ffafc0f730bcdd3e913744f734d2;hb=6d92327e88d2bb4c03a1b84663e50497f99fc24f;hp=ebd59a097076d05fe6b3eadf4c2ffae57a78547d;hpb=97ac28e65ca20b5649552597afaeee1d67766f6a;p=apitrace diff --git a/common/os_posix.cpp b/common/os_posix.cpp index ebd59a0..7d39d8a 100644 --- a/common/os_posix.cpp +++ b/common/os_posix.cpp @@ -143,8 +143,17 @@ int execute(char * const * args) return -1; } int status = -1; + int ret; waitpid(pid, &status, 0); - return status; + if (WIFEXITED(status)) { + ret = WEXITSTATUS(status); + } else if (WIFSIGNALED(status)) { + // match shell return code + ret = WTERMSIG(status) + 128; + } else { + ret = 128; + } + return ret; } }