aboutsummaryrefslogtreecommitdiff
path: root/src/zen/cmds/service_cmd.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-01-08 14:21:11 +0100
committerDan Engelbrecht <[email protected]>2025-01-08 14:21:11 +0100
commit2696ea2322dfdd7b7a5b08843b6d8aca9aedd741 (patch)
treec4aee88cf1b3d707a6e0e7b6a427db2d735b9898 /src/zen/cmds/service_cmd.cpp
parentadd ServiceLevel for service processes: User, AllUsers and Service (diff)
downloadarchived-zen-2696ea2322dfdd7b7a5b08843b6d8aca9aedd741.tar.xz
archived-zen-2696ea2322dfdd7b7a5b08843b6d8aca9aedd741.zip
use attachconsole to send ctrl+c to running process
Diffstat (limited to 'src/zen/cmds/service_cmd.cpp')
-rw-r--r--src/zen/cmds/service_cmd.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/zen/cmds/service_cmd.cpp b/src/zen/cmds/service_cmd.cpp
index 7727ed8a2..fc56293af 100644
--- a/src/zen/cmds/service_cmd.cpp
+++ b/src/zen/cmds/service_cmd.cpp
@@ -315,6 +315,11 @@ ServiceCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
ZEN_CONSOLE("Service '{}' is not installed", m_ServiceName);
return 0;
}
+ if (Info.Status != ServiceStatus::Stopped)
+ {
+ ZEN_CONSOLE("Service '{}' is running, stop before uninstalling", m_ServiceName);
+ return 0;
+ }
#if ZEN_PLATFORM_WINDOWS
if (!WinIsElevated() && (Info.Spec.ServiceLevel != ServiceLevel::CurrentUser))
@@ -352,7 +357,7 @@ ServiceCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
}
#if ZEN_PLATFORM_WINDOWS
- if (!WinIsElevated() && (Info.Spec.ServiceLevel != ServiceLevel::CurrentUser))
+ if (!WinIsElevated() && (Info.Spec.ServiceLevel == ServiceLevel::SystemService))
{
return WinRelaunchElevated();
}
@@ -387,7 +392,7 @@ ServiceCommand::Run(const ZenCliOptions& GlobalOptions, int argc, char** argv)
}
#if ZEN_PLATFORM_WINDOWS
- if (!WinIsElevated() && (Info.Spec.ServiceLevel != ServiceLevel::CurrentUser))
+ if (!WinIsElevated() && (Info.Spec.ServiceLevel == ServiceLevel::SystemService))
{
return WinRelaunchElevated();
}