mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-30 10:12:35 +00:00
Fix panic when using -field with read or write with a non-string value.
Fixes #1308
This commit is contained in:
@@ -70,9 +70,9 @@ func (c *ReadCommand) Run(args []string) int {
|
|||||||
// directly print the message. If mitchellh/cli exposes method
|
// directly print the message. If mitchellh/cli exposes method
|
||||||
// to print without CR, this check needs to be removed.
|
// to print without CR, this check needs to be removed.
|
||||||
if reflect.TypeOf(c.Ui).String() == "*cli.BasicUi" {
|
if reflect.TypeOf(c.Ui).String() == "*cli.BasicUi" {
|
||||||
fmt.Fprintf(os.Stdout, val.(string))
|
fmt.Fprintf(os.Stdout, fmt.Sprintf("%v", val))
|
||||||
} else {
|
} else {
|
||||||
c.Ui.Output(val.(string))
|
c.Ui.Output(fmt.Sprintf("%v", val))
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -82,9 +82,9 @@ func (c *WriteCommand) Run(args []string) int {
|
|||||||
// directly print the message. If mitchellh/cli exposes method
|
// directly print the message. If mitchellh/cli exposes method
|
||||||
// to print without CR, this check needs to be removed.
|
// to print without CR, this check needs to be removed.
|
||||||
if reflect.TypeOf(c.Ui).String() == "*cli.BasicUi" {
|
if reflect.TypeOf(c.Ui).String() == "*cli.BasicUi" {
|
||||||
fmt.Fprintf(os.Stdout, val.(string))
|
fmt.Fprintf(os.Stdout, fmt.Sprintf("%v", val))
|
||||||
} else {
|
} else {
|
||||||
c.Ui.Output(val.(string))
|
c.Ui.Output(fmt.Sprintf("%v", val))
|
||||||
}
|
}
|
||||||
return 0
|
return 0
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user