Skip to content

Commit

Permalink
fine tune program return code
Browse files Browse the repository at this point in the history
  • Loading branch information
pgdurand committed May 12, 2017
1 parent 23ea4f7 commit 2db88eb
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tools/PlastCmd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ using namespace launcher::core;
int main (int argc, char* argv[])
{
PlastOptionsParser parser;
int retcode = 0;
try {
/** We create a Properties instance for collecting both init properties file and user command line options. */
IProperties* props = new Properties ();
Expand Down Expand Up @@ -146,20 +147,23 @@ int main (int argc, char* argv[])
catch (OptionFailure& e)
{
if (parser.saw(STR_OPTION_HELP)) { parser.displayHelp (stdout); }
else { parser.displayErrors (stdout); parser.displayHelpShort();}
else { parser.displayErrors (stdout); parser.displayHelpShort(); retcode = 2;}
}
catch (statistics::GlobalParametersFailure& e)
{
fprintf (stderr, MSG_MAIN_MSG2, e.getMessage());
retcode = 3;
}
catch (const char* e)
{
fprintf (stderr, MSG_MAIN_MSG3, e);
retcode = 4;
}
catch (...)
{
fprintf (stderr, MSG_MAIN_MSG4);
fprintf (stderr, "%s", MSG_MAIN_MSG4);
retcode = 5;
}

return 0;
return retcode;
}

0 comments on commit 2db88eb

Please sign in to comment.