From 590938dfe1549d70b529c4bc819503f14f4eea89 Mon Sep 17 00:00:00 2001 From: Rootul P Date: Thu, 11 Jan 2024 11:10:49 -0500 Subject: [PATCH] fix: `--output-document` flag for multisign (#363) * fix: output-document flag * Revert "fix: output-document flag" This reverts commit 991be5e443311fa986260cc85dada6829fddc3f9. * fix: cherry pick just the fix --- x/auth/client/cli/tx_multisign.go | 21 ++++----------------- 1 file changed, 4 insertions(+), 17 deletions(-) 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 } }