From 2a3d596083c0778c703bb4d9aaef414689f267f8 Mon Sep 17 00:00:00 2001 From: Javad Date: Sat, 2 Mar 2024 16:01:53 +0330 Subject: [PATCH] fix: return when error happen --- main.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/main.go b/main.go index 3323ca4..3275249 100644 --- a/main.go +++ b/main.go @@ -7,8 +7,8 @@ import ( "log" "os" "os/exec" - "regexp" "os/signal" + "regexp" "strconv" "sync" "syscall" @@ -70,11 +70,9 @@ func main() { ctx, cancel := context.WithCancel(context.Background()) defer func() { - log.Println("Exiting...") os.Exit(0) }() - for _, val := range cfg.Validators { args := make([]string, 0) args = append(args, "--path", cfg.WalletPath, "tx", "bond") @@ -100,7 +98,7 @@ func main() { select { case s := <-interrupt: cancel() - log.Printf("task canceled by user, %s", s.String()) + log.Printf("staker canceled by user, %s", s.String()) } }() @@ -117,6 +115,7 @@ func runCmd(ctx context.Context, pactusWalletExecPath, validator string, wg *syn out, err := exec.CommandContext(ctx, pactusWalletExecPath, args...).Output() if err != nil { log.Printf("validator: %s err: %s, msg: %s", validator, err.Error(), string(out)) + return } log.Println(string(out)) }