From 61c6bf35d6996a131714e88199d176880e9a8ade Mon Sep 17 00:00:00 2001 From: Viktor Liu Date: Fri, 13 Jun 2025 19:15:46 +0200 Subject: [PATCH] Return service check err --- client/cmd/service_installer.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/client/cmd/service_installer.go b/client/cmd/service_installer.go index 648f53fc4..951efcc73 100644 --- a/client/cmd/service_installer.go +++ b/client/cmd/service_installer.go @@ -1,8 +1,10 @@ //go:build !ios && !android + package cmd import ( "context" + "errors" "fmt" "os" "path/filepath" @@ -12,6 +14,8 @@ import ( "github.com/spf13/cobra" ) +var ErrGetServiceStatus = fmt.Errorf("failed to get service status") + // Common service command setup func setupServiceCommand(cmd *cobra.Command) error { SetFlagsFromEnvVars(rootCmd) @@ -160,7 +164,7 @@ This command will temporarily stop the service, update its configuration, and re } wasRunning, err := isServiceRunning() - if err != nil { + if err != nil && !errors.Is(err, ErrGetServiceStatus) { return fmt.Errorf("check service status: %w", err) } @@ -224,7 +228,7 @@ func isServiceRunning() (bool, error) { status, err := s.Status() if err != nil { - return false, nil + return false, fmt.Errorf("%w: %w", ErrGetServiceStatus, err) } return status == service.StatusRunning, nil