diff options
Diffstat (limited to 'zenserver/zenserver.cpp')
| -rw-r--r-- | zenserver/zenserver.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/zenserver/zenserver.cpp b/zenserver/zenserver.cpp index eb0324161..f36cfba48 100644 --- a/zenserver/zenserver.cpp +++ b/zenserver/zenserver.cpp @@ -11,9 +11,9 @@ #include <zencore/timer.h> #include <zencore/windows.h> #include <zenhttp/httpserver.h> -#include <zenutil/zenserverprocess.h> #include <zenstore/cas.h> #include <zenstore/cidstore.h> +#include <zenutil/zenserverprocess.h> #include <fmt/format.h> #include <mimalloc-new-delete.h> @@ -40,6 +40,10 @@ #include "config.h" #include "diag/logging.h" +#if ZEN_PLATFORM_WINDOWS +# include "windows/service.h" +#endif + ////////////////////////////////////////////////////////////////////////// // Sentry // @@ -422,7 +426,7 @@ private: bool m_DebugOptionForcedCrash = false; }; -} +} // namespace zen int main(int argc, char* argv[]) @@ -436,6 +440,22 @@ main(int argc, char* argv[]) ParseGlobalCliOptions(argc, argv, GlobalOptions, ServiceConfig); InitializeLogging(GlobalOptions); +#if ZEN_PLATFORM_WINDOWS + if (GlobalOptions.InstallService) + { + SvcInstall(); + + std::exit(0); + } + + if (GlobalOptions.UninstallService) + { + SvcDelete(); + + std::exit(0); + } +#endif + #if USE_SENTRY // Initialize sentry.io client @@ -443,7 +463,7 @@ main(int argc, char* argv[]) sentry_options_set_dsn(SentryOptions, "https://[email protected]/5919284"); sentry_init(SentryOptions); - auto _ = zen::MakeGuard([&] { sentry_close(); }); + auto _ = zen::MakeGuard([] { sentry_close(); }); #endif try |