mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 14:43:55 +08:00
Check for waitstatus orientation via cmake
Yeah we need the long way around because old glibc versions have weird WEXITSTATUS.
This commit is contained in:
parent
122b6c1734
commit
bcd84c6908
|
@ -268,6 +268,16 @@ IF (NOT LIBATOMIC_NOT_NEEDED)
|
|||
set(ATOMIC_LIBRARY "atomic")
|
||||
endif()
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <sys/wait.h>
|
||||
|
||||
int main() {
|
||||
static_assert(WEXITSTATUS(0x007f) == 0x7f);
|
||||
return 0;
|
||||
}
|
||||
"
|
||||
HAVE_WAITSTATUS_SIGNAL_RET)
|
||||
|
||||
IF (APPLE)
|
||||
# Check if mbrtowc implementation attempts to encode invalid UTF-8 sequences
|
||||
# Known culprits: at least some versions of macOS (confirmed Snow Leopard and Yosemite)
|
||||
|
|
|
@ -103,6 +103,9 @@
|
|||
/* Define to 1 if you have the `wcstod_l' function. */
|
||||
#cmakedefine HAVE_WCSTOD_L 1
|
||||
|
||||
/* Define to 1 if the status that wait returns and WEXITSTATUS expects is signal and then ret instead of the other way around. */
|
||||
#cmakedefine HAVE_WAITSTATUS_SIGNAL_RET 1
|
||||
|
||||
/* Define to 1 if the winsize struct and TIOCGWINSZ macro exist */
|
||||
#cmakedefine HAVE_WINSIZE 1
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ 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
|
||||
#elif HAVE_WAITSTATUS_SIGNAL_RET
|
||||
// It's encoded signal and then status
|
||||
// The return status is in the lower byte.
|
||||
return ((sig) << 8 | (ret));
|
||||
|
|
Loading…
Reference in New Issue
Block a user