From d5bd243f40428937199c0ce9baa857d3f07dfd90 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Wed, 17 Jun 2015 22:02:34 +0100 Subject: Ensure an AppInstance exists before processing options --- project2/console/p2consoleMain.cpp | 3 ++- project2/daemon/p2daemonMain.cpp | 7 +++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/project2/console/p2consoleMain.cpp b/project2/console/p2consoleMain.cpp index 31ffe70..62f09b0 100644 --- a/project2/console/p2consoleMain.cpp +++ b/project2/console/p2consoleMain.cpp @@ -8,9 +8,10 @@ main(int argc, char ** argv) { OptionsSources::Add("", new CommandLineArguments(argc, argv, &ConsoleApplicationEngine::appendScript)); Plugable::onAllComponents(boost::bind(&ComponentLoader::onBegin, _1)); - OptionsSource::loadSources([] { return ConsoleApplicationEngine::reqPlatform;} ); ConsoleApplicationEngine app; + OptionsSource::loadSources([] { return ConsoleApplicationEngine::reqPlatform;} ); + app.process(); Plugable::onAllComponents(boost::bind(&ComponentLoader::onPeriodic, _1)); diff --git a/project2/daemon/p2daemonMain.cpp b/project2/daemon/p2daemonMain.cpp index 8feada2..95de88e 100644 --- a/project2/daemon/p2daemonMain.cpp +++ b/project2/daemon/p2daemonMain.cpp @@ -47,16 +47,15 @@ main(int argc, char ** argv) Plugable::onAllComponents(boost::bind(&ComponentLoader::onBegin, _1)); OptionsSources::Add("_2", new CommandLineArguments(argc, argv, [](const char * a) { throw UnsupportedArguments(a); })); + + DaemonAppEngine dae(argc, argv); OptionsSource::loadSources([] { return DaemonAppEngine::reqPlatform;} ); - //Plugable::onAllComponents(boost::bind(&ComponentLoader::onBefore, _1)); - + if (DaemonAppEngine::daemonize) { daemonize(); } - DaemonAppEngine dae(argc, argv); dae.process(); - //Plugable::onAllComponents(boost::bind(&ComponentLoader::onIteration, _1)); Plugable::onAllComponents(boost::bind(&ComponentLoader::onIdle, _1)); } -- cgit v1.2.3