diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/functional_interface.hpp b/iceoryx_hoofs/include/iceoryx_hoofs/cxx/functional_interface.hpp index e67065b943..e7569626f6 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/cxx/functional_interface.hpp +++ b/iceoryx_hoofs/include/iceoryx_hoofs/cxx/functional_interface.hpp @@ -18,8 +18,9 @@ #include "iceoryx_hoofs/cxx/function_ref.hpp" #include "iceoryx_hoofs/cxx/type_traits.hpp" +#include "iceoryx_hoofs/platform/unistd.hpp" -#include +#include #include namespace iox diff --git a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/functional_interface.inl b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/functional_interface.inl index cd0ce76e29..3e5967cc68 100644 --- a/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/functional_interface.inl +++ b/iceoryx_hoofs/include/iceoryx_hoofs/internal/cxx/functional_interface.inl @@ -37,7 +37,9 @@ inline void Expect::expect(const StringType& msg) const noexcept if (!(*static_cast(this))) { - std::cout << msg << std::endl; + // it is possible that expect is called inside an error handler therefore we + // use write + IOX_DISCARD_RESULT(write(STDERR_FILENO, &msg[0], strlen(&msg[0]))); Ensures(false); } } @@ -53,7 +55,9 @@ inline ValueType& ExpectWithValue::expect(const StringType& if (!(*derivedThis)) { - std::cout << msg << std::endl; + // it is possible that expect is called inside an error handler therefore we + // use write + IOX_DISCARD_RESULT(write(STDERR_FILENO, &msg[0], strlen(&msg[0]))); Ensures(false); }