mirror of
https://github.com/safing/portmaster
synced 2025-09-02 02:29:12 +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"
|
"github.com/spf13/cobra"
|
||||||
"golang.org/x/sys/windows"
|
"golang.org/x/sys/windows"
|
||||||
|
"golang.org/x/sys/windows/svc"
|
||||||
"golang.org/x/sys/windows/svc/mgr"
|
"golang.org/x/sys/windows/svc/mgr"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -185,6 +186,11 @@ func uninstallWindowsService(cmd *cobra.Command, args []string) error {
|
||||||
}
|
}
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
|
_, err = s.Control(svc.Stop)
|
||||||
|
if err != nil {
|
||||||
|
log.Printf("failed to stop service: %s\n", err)
|
||||||
|
}
|
||||||
|
|
||||||
// delete service
|
// delete service
|
||||||
err = s.Delete()
|
err = s.Delete()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Add table
Reference in a new issue