From aeeb0d59d3ed40c3b0d9cecd3c19a52f005dd140 Mon Sep 17 00:00:00 2001 From: "Daniel, Dao Quang Minh" Date: Wed, 24 Sep 2014 03:26:53 -0400 Subject: [PATCH] print everything except progress in non-terminal Instead of only checking `Progress != nil` (which is always true because the server sends `"progressDetail":{}` when it doesnt have the progress), we also check if `Progress.String() != ""`, which should be sufficient to filter out the progress data. Docker-DCO-1.1-Signed-off-by: Daniel, Dao Quang Minh (github: dqminh) --- utils/jsonmessage.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utils/jsonmessage.go b/utils/jsonmessage.go index 3752c997f1..bdc47f0e1d 100644 --- a/utils/jsonmessage.go +++ b/utils/jsonmessage.go @@ -97,7 +97,7 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error { // [2K = erase entire current line fmt.Fprintf(out, "%c[2K\r", 27) endl = "\r" - } else if jm.Progress != nil { //disable progressbar in non-terminal + } else if jm.Progress != nil && jm.Progress.String() != "" { //disable progressbar in non-terminal return nil } if jm.Time != 0 { @@ -109,7 +109,7 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error { if jm.From != "" { fmt.Fprintf(out, "(from %s) ", jm.From) } - if jm.Progress != nil { + if jm.Progress != nil && isTerminal { fmt.Fprintf(out, "%s %s%s", jm.Status, jm.Progress.String(), endl) } else if jm.ProgressMessage != "" { //deprecated fmt.Fprintf(out, "%s %s%s", jm.Status, jm.ProgressMessage, endl)