mirror of
https://github.com/safing/portmaster
synced 2025-09-01 10:09:11 +00:00
Stop service before uninstalling
This commit is contained in:
parent
c6083fc464
commit
169901ccef
1 changed files with 6 additions and 0 deletions
|
@ -15,6 +15,7 @@ import (
|
|||
|
||||
"github.com/spf13/cobra"
|
||||
"golang.org/x/sys/windows"
|
||||
"golang.org/x/sys/windows/svc"
|
||||
"golang.org/x/sys/windows/svc/mgr"
|
||||
)
|
||||
|
||||
|
@ -185,6 +186,11 @@ func uninstallWindowsService(cmd *cobra.Command, args []string) error {
|
|||
}
|
||||
defer s.Close()
|
||||
|
||||
_, err = s.Control(svc.Stop)
|
||||
if err != nil {
|
||||
log.Printf("failed to stop service: %s\n", err)
|
||||
}
|
||||
|
||||
// delete service
|
||||
err = s.Delete()
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Reference in a new issue