diff --git a/src/proc.h b/src/proc.h index 6ac42c753..1b6ed6e60 100644 --- a/src/proc.h +++ b/src/proc.h @@ -73,7 +73,12 @@ class proc_status_t { static constexpr int w_exitcode(int ret, int sig) { #ifdef W_EXITCODE return W_EXITCODE(ret, sig); +#elif WEXITSTATUS(0x007f) == 0x7f + // It's encoded signal and then status + // The return status is in the lower byte. + return ((sig) << 8 | (ret)); #else + // The status is encoded in the upper byte. return ((ret) << 8 | (sig)); #endif }