diff --git a/include/cppshell/shell.hpp b/include/cppshell/shell.hpp index 07b07fd..2406d4c 100644 --- a/include/cppshell/shell.hpp +++ b/include/cppshell/shell.hpp @@ -3,8 +3,8 @@ #include #include -#if !defined(__linux__) -#error Only linux supported +#if !defined(__linux__) && !defined(__APPLE__) +#error Only linux and Macos supported #endif namespace cppshell { diff --git a/src/shell.cpp b/src/shell.cpp index 013778d..4aaae6c 100644 --- a/src/shell.cpp +++ b/src/shell.cpp @@ -2,7 +2,15 @@ #include #include +#include + +#if defined(__linux__) #include +#elif defined(__APPLE__) +#include +#else +#error Supported only on Linux and Mac +#endif #include #include diff --git a/src/utils/signals.cpp b/src/utils/signals.cpp index a41559d..426dbd6 100644 --- a/src/utils/signals.cpp +++ b/src/utils/signals.cpp @@ -3,9 +3,12 @@ #include #include +#if !defined(__APPLE__) thread_local SigpipeState global_state; +#endif bool IgnoreSigpipe() { +#if !defined(__APPLE__) sigset_t pending; sigemptyset(&pending); sigpending(&pending); @@ -25,9 +28,12 @@ bool IgnoreSigpipe() { return true; } return false; +#endif + return false; } void UnignoreSigpipe() { +#if !defined(__APPLE__) sigset_t pending; sigemptyset(&pending); sigpending(&pending); @@ -47,4 +53,5 @@ void UnignoreSigpipe() { if (global_state.sigpipe_unblock) { pthread_sigmask(SIG_UNBLOCK, &sigpipe_mask, NULL); } +#endif }