Skip to content

Commit

Permalink
Escape ‘%’ in console.OutStyle arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
11janci committed Mar 31, 2019
1 parent 786eb65 commit 3ade5d5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/minikube/console/console.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,19 @@ func HasStyle(style string) bool {

// OutStyle writes a stylized and formatted message to stdout
func OutStyle(style, format string, a ...interface{}) error {
OutStyle, err := applyStyle(style, useColor, fmt.Sprintf(format, a...))
outStyled, err := applyStyle(style, useColor, format, a...)
// format the output string and escape any outstanding '%' signs so that they don't
// get interpreted as a formatting directive down the line
outStyled = strings.Replace(outStyled, "%", "%%", -1)

if err != nil {
glog.Errorf("applyStyle(%s): %v", style, err)
if oerr := OutLn(format, a...); oerr != nil {
glog.Errorf("Out failed: %v", oerr)
}
return err
}
return Out(OutStyle)
return Out(outStyled)
}

// Out writes a basic formatted string to stdout
Expand Down

0 comments on commit 3ade5d5

Please sign in to comment.