Exit instead of abort (#233)

Uses std::exit instead of abort to terminate when exceptions are disabled.
This commit is contained in:
Daniel Lemire 2020-05-28 18:30:35 -04:00 committed by GitHub
parent 12bc8d78e7
commit 794c975287
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -480,11 +480,10 @@ namespace cxxopts
throw T{text};
#else
// Otherwise manually instantiate the exception, print what() to stderr,
// and abort
// and exit
T exception{text};
std::cerr << exception.what() << std::endl;
std::cerr << "Aborting (exceptions disabled)..." << std::endl;
std::abort();
std::exit(EXIT_FAILURE);
#endif
}