From e141d8e10637f7438ff2d8dca0fa9d010781eac2 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 7 Jul 2023 11:58:13 +0200 Subject: [PATCH] fix(simapp): do not repeat errors (backport #16865) (#16872) Co-authored-by: Julien Robert --- simapp/simd/cmd/root.go | 5 +++-- simapp/simd/cmd/root_v2.go | 5 +++-- simapp/simd/main.go | 4 ++-- 3 files changed, 8 insertions(+), 6 deletions(-) diff --git a/simapp/simd/cmd/root.go b/simapp/simd/cmd/root.go index 2de3d5d5eccb..ea75692e92ff 100644 --- a/simapp/simd/cmd/root.go +++ b/simapp/simd/cmd/root.go @@ -65,8 +65,9 @@ func NewRootCmd() *cobra.Command { WithViper("") // In simapp, we don't use any prefix for env variables. rootCmd := &cobra.Command{ - Use: "simd", - Short: "simulation app", + Use: "simd", + Short: "simulation app", + SilenceErrors: true, PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { // set the default command outputs cmd.SetOut(cmd.OutOrStdout()) diff --git a/simapp/simd/cmd/root_v2.go b/simapp/simd/cmd/root_v2.go index 3dd21f92b679..99b99640b87d 100644 --- a/simapp/simd/cmd/root_v2.go +++ b/simapp/simd/cmd/root_v2.go @@ -76,8 +76,9 @@ func NewRootCmd() *cobra.Command { WithViper("") // In simapp, we don't use any prefix for env variables. rootCmd := &cobra.Command{ - Use: "simd", - Short: "simulation app", + Use: "simd", + Short: "simulation app", + SilenceErrors: true, PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { // set the default command outputs cmd.SetOut(cmd.OutOrStdout()) diff --git a/simapp/simd/main.go b/simapp/simd/main.go index 8e88ab9a618a..9643af43bc80 100644 --- a/simapp/simd/main.go +++ b/simapp/simd/main.go @@ -1,9 +1,9 @@ package main import ( + "fmt" "os" - "cosmossdk.io/log" "cosmossdk.io/simapp" "cosmossdk.io/simapp/simd/cmd" @@ -13,7 +13,7 @@ import ( func main() { rootCmd := cmd.NewRootCmd() if err := svrcmd.Execute(rootCmd, "", simapp.DefaultNodeHome); err != nil { - log.NewLogger(rootCmd.OutOrStderr()).Error("failure when running app", "err", err) + fmt.Fprintln(rootCmd.OutOrStderr(), err) os.Exit(1) } }