Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use anonymous pipes for stdout/stderr redirection. #2472

Open
wants to merge 5 commits into
base: devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/catch2/internal/catch_enforce.cpp
Expand Up @@ -9,6 +9,7 @@
#include <catch2/internal/catch_stdstreams.hpp>

#include <stdexcept>
#include <system_error>


namespace Catch {
Expand Down Expand Up @@ -36,6 +37,11 @@ namespace Catch {
throw_exception(std::runtime_error(msg));
}

[[noreturn]]
void throw_system_error(int ev, const std::error_category& ecat) {
throw_exception(std::system_error(ev, ecat));
}



} // namespace Catch;
5 changes: 5 additions & 0 deletions src/catch2/internal/catch_enforce.hpp
Expand Up @@ -32,6 +32,8 @@ namespace Catch {
void throw_domain_error(std::string const& msg);
[[noreturn]]
void throw_runtime_error(std::string const& msg);
[[noreturn]]
void throw_system_error(int ev, const std::error_category& ecat);

} // namespace Catch;

Expand All @@ -47,6 +49,9 @@ namespace Catch {
#define CATCH_RUNTIME_ERROR(...) \
Catch::throw_runtime_error(CATCH_MAKE_MSG( __VA_ARGS__ ))

#define CATCH_SYSTEM_ERROR(ev, ecat) \
Catch::throw_system_error((ev), (ecat))

#define CATCH_ENFORCE( condition, ... ) \
do{ if( !(condition) ) CATCH_ERROR( __VA_ARGS__ ); } while(false)

Expand Down