Skip to content

Commit af4f8b8

Browse files
committed
Set exit codes on Program failure
1 parent 82c24b3 commit af4f8b8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Program.cxx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,11 @@ int Program::execute(int argc, char** argv)
108108
auto message = boost::get_error_info<ErrorInfo::Message>(e);
109109
std::cout << "Program options invalid: " << *message << "\n\n";
110110
printHelp(optionsDescription);
111+
return 2;
111112
} catch (const po::error& e) {
112113
std::cout << "Program options error: " << e.what() << "\n\n";
113114
printHelp(optionsDescription);
115+
return 2;
114116
} catch (const std::exception& e) {
115117
#if (BOOST_VERSION >= 105400)
116118
std::cout << "Error: " << e.what() << '\n'
@@ -120,6 +122,7 @@ int Program::execute(int argc, char** argv)
120122
std::cout << "Error: " << e.what() << '\n'
121123
<< boost::diagnostic_information(e) << '\n';
122124
#endif
125+
return 1;
123126
}
124127

125128
return 0;

0 commit comments

Comments
 (0)