chore: write gentx info to cmd.ErrOrStderr (#20616)

This commit is contained in:
Mark Rushakoff
2024-06-11 08:31:06 +00:00
committed by GitHub
parent e5e9b0e645
commit 9e1d28e2a6
3 changed files with 6 additions and 4 deletions
+1
View File
@@ -186,6 +186,7 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i
* (server) [#20140](https://github.com/cosmos/cosmos-sdk/pull/20140) Remove embedded grpc-web proxy in favor of standalone grpc-web proxy. [Envoy Proxy](https://www.envoyproxy.io/docs/envoy/latest/start/start)
* (client) [#20255](https://github.com/cosmos/cosmos-sdk/pull/20255) Use comet proofOp proto type instead of sdk version to avoid needing to translate to later be proven in the merkle proof runtime.
* (all) [#19726](https://github.com/cosmos/cosmos-sdk/pull/19726) Integrate comet v1
* (client) [#20616](https://github.com/cosmos/cosmos-sdk/pull/20616) gentx subcommand output goes to `cmd.ErrOrStderr()` instead of being hardcoded to `os.Stderr`
### Client Breaking Changes
+1 -1
View File
@@ -52,7 +52,7 @@ func CollectGenTxsCmd(genBalIterator types.GenesisBalancesIterator, validator ty
toPrint.AppMessage = appMessage
return displayInfo(toPrint)
return displayInfo(cmd.ErrOrStderr(), toPrint)
},
}
+4 -3
View File
@@ -5,6 +5,7 @@ import (
"encoding/json"
"errors"
"fmt"
"io"
"os"
"path/filepath"
@@ -58,13 +59,13 @@ func newPrintInfo(moniker, chainID, nodeID, genTxsDir string, appMessage json.Ra
}
}
func displayInfo(info printInfo) error {
func displayInfo(dst io.Writer, info printInfo) error {
out, err := json.MarshalIndent(info, "", " ")
if err != nil {
return err
}
_, err = fmt.Fprintf(os.Stderr, "%s\n", out)
_, err = fmt.Fprintf(dst, "%s\n", out)
return err
}
@@ -175,7 +176,7 @@ func InitCmd(mm *module.Manager) *cobra.Command {
toPrint := newPrintInfo(config.Moniker, chainID, nodeID, "", appState)
cfg.WriteConfigFile(filepath.Join(config.RootDir, "config", "config.toml"), config)
return displayInfo(toPrint)
return displayInfo(cmd.ErrOrStderr(), toPrint)
},
}