aboutsummaryrefslogtreecommitdiff
path: root/zenserver/zenserver.cpp
diff options
context:
space:
mode:
authorMartin Ridgers <[email protected]>2021-11-16 17:13:39 +0100
committerMartin Ridgers <[email protected]>2021-11-16 17:25:28 +0100
commitac8094099ad044ac0b21b9c531cf0b9c1d8bf5d7 (patch)
tree409659f9cbcb09e711d6a4de23ea87e8c7b437d1 /zenserver/zenserver.cpp
parentSeparated Windows service scaffolding and the zenserver main loop (diff)
downloadzen-ac8094099ad044ac0b21b9c531cf0b9c1d8bf5d7.tar.xz
zen-ac8094099ad044ac0b21b9c531cf0b9c1d8bf5d7.zip
Hooked up zenserver:main() to ZenEntryPoint::Run() on POSIX
Diffstat (limited to 'zenserver/zenserver.cpp')
-rw-r--r--zenserver/zenserver.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp
index ad4d1ba84..f0648698c 100644
--- a/zenserver/zenserver.cpp
+++ b/zenserver/zenserver.cpp
@@ -917,7 +917,7 @@ public:
virtual int Run() override;
private:
- ZenEntryPoint m_EntryPoint;
+ zen::ZenEntryPoint m_EntryPoint;
};
int
@@ -967,7 +967,6 @@ main(int argc, char* argv[])
try
{
-#if ZEN_PLATFORM_WINDOWS
ZenServerOptions GlobalOptions;
ZenServiceConfig ServiceConfig;
ParseGlobalCliOptions(argc, argv, GlobalOptions, ServiceConfig);
@@ -978,6 +977,7 @@ main(int argc, char* argv[])
std::filesystem::create_directories(GlobalOptions.DataDir);
}
+#if ZEN_PLATFORM_WINDOWS
if (GlobalOptions.InstallService)
{
WindowsService::Install();
@@ -995,8 +995,14 @@ main(int argc, char* argv[])
ZenWindowsService App(GlobalOptions, ServiceConfig);
return App.ServiceMain();
#else
- return 1;
-#endif
+ if (GlobalOptions.InstallService || GlobalOptions.UninstallService)
+ {
+ throw std::runtime_error("Service mode is not supported on this platform");
+ }
+
+ ZenEntryPoint App(GlobalOptions, ServiceConfig);
+ return App.Run();
+#endif // ZEN_PLATFORM_WINDOWS
}
catch (std::exception& Ex)
{