mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Merge pull request #8150 from dqminh/pull-output-non-terminal
Pull: print some data instead of newlines when output is not a terminal
This commit is contained in:
commit
9854b0aa40
1 changed files with 2 additions and 2 deletions
|
@ -97,7 +97,7 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error {
|
||||||
// <ESC>[2K = erase entire current line
|
// <ESC>[2K = erase entire current line
|
||||||
fmt.Fprintf(out, "%c[2K\r", 27)
|
fmt.Fprintf(out, "%c[2K\r", 27)
|
||||||
endl = "\r"
|
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
|
return nil
|
||||||
}
|
}
|
||||||
if jm.Time != 0 {
|
if jm.Time != 0 {
|
||||||
|
@ -109,7 +109,7 @@ func (jm *JSONMessage) Display(out io.Writer, isTerminal bool) error {
|
||||||
if jm.From != "" {
|
if jm.From != "" {
|
||||||
fmt.Fprintf(out, "(from %s) ", 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)
|
fmt.Fprintf(out, "%s %s%s", jm.Status, jm.Progress.String(), endl)
|
||||||
} else if jm.ProgressMessage != "" { //deprecated
|
} else if jm.ProgressMessage != "" { //deprecated
|
||||||
fmt.Fprintf(out, "%s %s%s", jm.Status, jm.ProgressMessage, endl)
|
fmt.Fprintf(out, "%s %s%s", jm.Status, jm.ProgressMessage, endl)
|
||||||
|
|
Loading…
Reference in a new issue