mirror of
https://github.com/docker/compose.git
synced 2026-02-09 01:59:22 +08:00
Prevented incorrect progress metrics to break compose display.
Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
committed by
Guillaume Lours
parent
1297f97aef
commit
d4c1987638
@@ -347,7 +347,12 @@ func (w *ttyWriter) lineText(t *task, pad string, terminalWidth, statusPadding i
|
||||
}
|
||||
total += child.total
|
||||
current += child.current
|
||||
completion = append(completion, percentChars[(len(percentChars)-1)*child.percent/100])
|
||||
r := len(percentChars) - 1
|
||||
p := child.percent
|
||||
if p > 100 {
|
||||
p = 100
|
||||
}
|
||||
completion = append(completion, percentChars[r*p/100])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -416,6 +416,9 @@ func toPullProgressEvent(parent string, jm jsonmessage.JSONMessage, events api.E
|
||||
total = jm.Progress.Total
|
||||
if jm.Progress.Total > 0 {
|
||||
percent = int(jm.Progress.Current * 100 / jm.Progress.Total)
|
||||
if percent > 100 {
|
||||
percent = 100
|
||||
}
|
||||
}
|
||||
}
|
||||
case DownloadCompletePhase, AlreadyExistsPhase, PullCompletePhase:
|
||||
|
||||
@@ -155,6 +155,9 @@ func toPushProgressEvent(prefix string, jm jsonmessage.JSONMessage, events api.E
|
||||
total = jm.Progress.Total
|
||||
if jm.Progress.Total > 0 {
|
||||
percent = int(jm.Progress.Current * 100 / jm.Progress.Total)
|
||||
if percent > 100 {
|
||||
percent = 100
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user