fix: restore missing logic from refactoring

- Restore HTTP 400 status handling in log viewing that was lost during refactoring
- Restore service installation check in restart command that was missing after refactoring
This commit is contained in:
Cuong Manh Le
2025-07-30 17:35:49 +07:00
committed by Cuong Manh Le
parent ea98a59aba
commit 954395fa29
2 changed files with 17 additions and 5 deletions
+7
View File
@@ -2,8 +2,10 @@ package cli
import (
"context"
"errors"
"time"
"github.com/kardianos/service"
"github.com/spf13/cobra"
)
@@ -19,6 +21,11 @@ func (sc *ServiceCommand) Restart(cmd *cobra.Command, args []string) error {
return err
}
if _, err := s.Status(); errors.Is(err, service.ErrNotInstalled) {
mainLog.Load().Warn().Msg("service not installed")
return nil
}
p.cfg = &cfg
if iface == "" {
iface = "auto"