From af4f8b8a4c1e45e25fec2c32fb31f9e3d24a6c11 Mon Sep 17 00:00:00 2001 From: Kostas Alexopoulos Date: Thu, 4 Feb 2021 16:12:25 +0100 Subject: [PATCH] Set exit codes on Program failure --- src/Program.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Program.cxx b/src/Program.cxx index b9974c9..559064f 100644 --- a/src/Program.cxx +++ b/src/Program.cxx @@ -108,9 +108,11 @@ int Program::execute(int argc, char** argv) auto message = boost::get_error_info(e); std::cout << "Program options invalid: " << *message << "\n\n"; printHelp(optionsDescription); + return 2; } catch (const po::error& e) { std::cout << "Program options error: " << e.what() << "\n\n"; printHelp(optionsDescription); + return 2; } catch (const std::exception& e) { #if (BOOST_VERSION >= 105400) std::cout << "Error: " << e.what() << '\n' @@ -120,6 +122,7 @@ int Program::execute(int argc, char** argv) std::cout << "Error: " << e.what() << '\n' << boost::diagnostic_information(e) << '\n'; #endif + return 1; } return 0;