From fee64e16c27c192c135565e49e02df5fe9340c0e Mon Sep 17 00:00:00 2001 From: vishalnayak Date: Thu, 17 Sep 2015 11:37:21 -0400 Subject: [PATCH] Adding type checking to ensure only BasicUi is affected --- command/read.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/command/read.go b/command/read.go index fb8a86b94b..7a13764a1a 100644 --- a/command/read.go +++ b/command/read.go @@ -3,6 +3,7 @@ package command import ( "fmt" "os" + "reflect" "strings" ) @@ -60,8 +61,12 @@ func (c *ReadCommand) Run(args []string) int { // not desired. Since Vault CLI currently only uses BasicUi, // which writes to standard output, os.Stdout is used here to // directly print the message. If mitchellh/cli exposes method - // to print without CR, this has to be replaced by that. - fmt.Fprintf(os.Stdout, val.(string)) + // to print without CR, this check needs to be removed. + if reflect.TypeOf(c.Ui).String() == "*cli.BasicUi" { + fmt.Fprintf(os.Stdout, val.(string)) + } else { + c.Ui.Output(val.(string)) + } return 0 } else { c.Ui.Error(fmt.Sprintf(