mirror of
https://github.com/restic/restic.git
synced 2026-09-03 11:17:14 +00:00
ui/progress: don't print progress on non-interactive terminals
This reverts to the old behavior of not printing progress updates on non-interactive terminals. It was accidentally changed in #3058.
This commit is contained in:
@@ -53,3 +53,22 @@ func TestCounterNil(t *testing.T) {
|
||||
c.Add(1)
|
||||
c.Done()
|
||||
}
|
||||
|
||||
func TestCounterNoTick(t *testing.T) {
|
||||
finalSeen := false
|
||||
otherSeen := false
|
||||
|
||||
report := func(value uint64, d time.Duration, final bool) {
|
||||
if final {
|
||||
finalSeen = true
|
||||
} else {
|
||||
otherSeen = true
|
||||
}
|
||||
}
|
||||
c := progress.New(0, report)
|
||||
time.Sleep(time.Millisecond)
|
||||
c.Done()
|
||||
|
||||
test.Assert(t, finalSeen, "final call did not happen")
|
||||
test.Assert(t, !otherSeen, "unexpected status update")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user