Skip to content

Commit

Permalink
Set exit codes on Program failure
Browse files Browse the repository at this point in the history
  • Loading branch information
kostorr committed Feb 5, 2021
1 parent 82c24b3 commit af4f8b8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/Program.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,11 @@ int Program::execute(int argc, char** argv)
auto message = boost::get_error_info<ErrorInfo::Message>(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'
Expand All @@ -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;
Expand Down

0 comments on commit af4f8b8

Please sign in to comment.