aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/zen/cmds/service_cmd.cpp18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/zen/cmds/service_cmd.cpp b/src/zen/cmds/service_cmd.cpp
index 386046e66..fd4d3895e 100644
--- a/src/zen/cmds/service_cmd.cpp
+++ b/src/zen/cmds/service_cmd.cpp
@@ -92,6 +92,7 @@ namespace {
else
{
ZEN_CONSOLE("Failed to run elevated, operation did not complete.");
+ ReturnCode = DWORD(-1);
}
return (int)ReturnCode;
}
@@ -272,6 +273,14 @@ FmtServiceInfo(const ServiceInfo& Info, std::string_view Prefix)
return Result;
}
+enum class ServiceStatusReturnCode
+{
+ Running = 0, // successful return indicates proper installation and everything running smoothly
+ NotInstalled,
+ NotRunning,
+ UnknownError
+};
+
int
ServiceCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
{
@@ -304,12 +313,17 @@ ServiceCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
if (Ec)
{
ZEN_CONSOLE("Can't get information about service '{}'. Reason: '{}'", m_ServiceName, Ec.message());
- return 1;
+ return gsl::narrow<int>(ServiceStatusReturnCode::UnknownError);
}
if (Info.Status == ServiceStatus::NotInstalled)
{
ZEN_CONSOLE("Service '{}' is not installed", m_ServiceName);
- return 0;
+ return gsl::narrow<int>(ServiceStatusReturnCode::NotInstalled);
+ }
+ else if (Info.Status != ServiceStatus::Running)
+ {
+ ZEN_CONSOLE("Service '{}' is not running", m_ServiceName);
+ return gsl::narrow<int>(ServiceStatusReturnCode::NotRunning);
}
else
{