diff --git a/x/auth/client/cli/tx_multisign.go b/x/auth/client/cli/tx_multisign.go index 7b196adc3c02..d6826edf0d3d 100644 --- a/x/auth/client/cli/tx_multisign.go +++ b/x/auth/client/cli/tx_multisign.go @@ -186,27 +186,14 @@ func makeMultiSignCmd() func(cmd *cobra.Command, args []string) (err error) { } } - outputDoc, _ := cmd.Flags().GetString(flags.FlagOutputDocument) - if outputDoc == "" { - cmd.Printf("%s\n", json) - return - } - - fp, err := os.OpenFile(outputDoc, os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0o644) + closeFunc, err := setOutputFile(cmd) if err != nil { return err } - defer func() { - err2 := fp.Close() - if err == nil { - err = err2 - } - }() - - err = clientCtx.PrintBytes(json) - - return + defer closeFunc() + cmd.Printf("%s\n", json) + return nil } }