Extended checking if error is context cancelling

This commit is contained in:
bytedream 2022-03-21 17:11:01 +01:00
parent ac7904668f
commit f6f51799d7

View file

@ -7,6 +7,7 @@ import (
"net/http" "net/http"
"os" "os"
"runtime/debug" "runtime/debug"
"strings"
) )
var ( var (
@ -59,7 +60,7 @@ func Execute() {
} }
}() }()
if err := rootCmd.Execute(); err != nil { if err := rootCmd.Execute(); err != nil {
if err != context.Canceled { if !strings.HasSuffix(err.Error(), context.Canceled.Error()) {
out.Exit("An error occurred: %v", err) out.Exit("An error occurred: %v", err)
} }
os.Exit(1) os.Exit(1)