Fix error when storagenode-updater service is stopped (#3440)
This commit is contained in:
parent
857c7f3cd7
commit
84fea5820f
@ -144,7 +144,7 @@ func cmdRun(cmd *cobra.Command, args []string) (err error) {
|
||||
loop := sync2.NewCycle(runCfg.CheckInterval)
|
||||
err = loop.Run(ctx, loopFunc)
|
||||
}
|
||||
if err != nil && errs2.IsCanceled(err) {
|
||||
if err != nil && !errs2.IsCanceled(err) {
|
||||
log.Fatal(err)
|
||||
}
|
||||
return nil
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
// Check if session is interactive
|
||||
interactive, err := svc.IsAnInteractiveSession()
|
||||
if err != nil {
|
||||
panic("Failed to determine if session is interactive:" + err.Error())
|
||||
@ -29,6 +30,16 @@ func init() {
|
||||
return
|
||||
}
|
||||
|
||||
// Check if the 'run' command is invoked
|
||||
if len(os.Args) < 2 {
|
||||
return
|
||||
}
|
||||
|
||||
if os.Args[1] != "run" {
|
||||
return
|
||||
}
|
||||
|
||||
// Initialize the Windows Service handler
|
||||
err = svc.Run("storagenode-updater", &service{})
|
||||
if err != nil {
|
||||
panic("Service failed: " + err.Error())
|
||||
|
Loading…
Reference in New Issue
Block a user