fixed GH #141: Application::run() documentation/implementation discrepancy

This commit is contained in:
Aleksandar Fabijanic
2013-03-30 16:59:29 -05:00
parent 5a8defd849
commit dbe5a37106
2 changed files with 7 additions and 4 deletions

View File

@@ -239,14 +239,15 @@ public:
/// not been registered. /// not been registered.
virtual int run(); virtual int run();
/// Runs the application by performing additional initializations /// Runs the application by performing additional (un)initializations
/// and calling the main() method. /// and calling the main() method.
/// ///
/// First calls initialize(), then calls main(), and /// First calls initialize(), then calls main(), and
/// finally calls uninitialize(). The latter will be called /// finally calls uninitialize(). The latter will be called
/// even if main() throws an exception. If initialize() throws /// even if main() throws an exception. If initialize() throws
/// an exception, main() will not be called and the exception /// an exception, main() will not be called and the exception
/// will be propagated to the caller. /// will be propagated to the caller. If uninitialize() throws
/// an exception, the exception will be propagated to the caller.
std::string commandName() const; std::string commandName() const;
/// Returns the command name used to invoke the application. /// Returns the command name used to invoke the application.

View File

@@ -318,12 +318,12 @@ void Application::stopOptionsProcessing()
int Application::run() int Application::run()
{ {
int rc = EXIT_CONFIG; int rc = EXIT_CONFIG;
initialize(*this);
try try
{ {
initialize(*this);
rc = EXIT_SOFTWARE; rc = EXIT_SOFTWARE;
rc = main(_unprocessedArgs); rc = main(_unprocessedArgs);
uninitialize();
} }
catch (Poco::Exception& exc) catch (Poco::Exception& exc)
{ {
@@ -337,6 +337,8 @@ int Application::run()
{ {
logger().fatal("system exception"); logger().fatal("system exception");
} }
uninitialize();
return rc; return rc;
} }